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);
Easy!
52a49399-05a5-48dd-abbc-0549ed3aeceb|0|.0
Programming
programming