To clamp a datetime to an arbitrary TimeSpan: –

 delta = a_dateTime.Ticks % TimeSpan.FromHours(1).Ticks;
 a_dateTime = a_dateTime.AddTicks(-delta);

 

 


Discover more from

Subscribe to get the latest posts sent to your email.

Leave a comment

Trending