Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting start and last time of day
Message
 
To
10/01/2006 16:03:31
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01085371
Message ID:
01085381
Views:
17
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform