Pages

Search This Blog

Monday, 6 January 2014

Add Hours to a DateTime object

This post is about adding some hours to a DateTime object. For instance when the time is 12.00 am and if you wish to add 23 hours the following code snippet can be used for reference. The below code gets the current date with time and adds 23 hours

DateTime today = DateTime.Now;today = today.AddHours(23); 

No comments:

Post a Comment