07 July 2010

C# code sample: How to trancate a date

// Use a new variable dtmTrancatedDate to store the trancated date

// Hour, Minutes and Seconds are trancated to 0

DateTime dtmTruncatedDate = new DateTime(dtmStartDate.Year, dtmStartDate.Month, startDate.Day,0,0,0);

dtmStartDate = dtmTruncatedDate;