22. August 2009 18:14
/
victor
/
/
Comments (0)
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!
ca201a9a-7acc-4967-b88d-fd3198df5b84|0|.0|27604f05-86ad-47ef-9e05-950bb762570c
Tags :