22. August 2009 18:14
Last week I need to write something to compare two datetime at the second level. So I have to trim the datetime part after second. There is the function I used to trim the datetime.
public static DateTime TrimDate(DateTime date, long ticks)
return new DateTime(date.Ticks - date.Ticks % ticks);
Examples about how to use the function
DateTime datNewDate = TrimDate(oldDate, TimeSpan.TicksPerSecond);