Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting start and last time of day
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01085371
Message ID:
01085381
Vues:
16
>No matter the datetime value I received, I need to obtain two date time values from that date. The first one is the start of the day and the second one, the last time of the day. So, I receive this datetime value:
>
>10/01/2006 13:00:56
>
>I should obtain:
>
>10/01/2006 00:00:00
>10/01/2006 23:59:59
>
>Do I need to convert the first datetime value to a string, manipulate that string, and convert it back to a datetime?


This might work for you:
DateTime now = DateTime.Now;

DateTime start = now.Date;
DateTime end = now.Date;
end = end.AddDays(1);
end = end.AddSeconds(-1);

MessageBox.Show(start.ToString(),"start");
MessageBox.Show(end.ToString(),"end");
Einar
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform