742 Views
Here is a bit of code should you ever need to calculate midnight datetime from a specific date. The solution is to subtract the time of day from the date. In the example, midnight datetime is calculated via myDateTime.Subtract(myDateTime.TimeOfDay) i.e. The TimeOfDay property is used here to represent the fraction of the day that has elapsed since midnight.
I would not recommend using the example in the blog.