dshinkle
asked on
Remove seconds from a date
I have a date datatype in C# that is a date and time. I need to remove the seconds from the date, so that if it is
12/29/2005 5:36:54 it would be 12/29/2005 5:36:00. How can I do this?
12/29/2005 5:36:54 it would be 12/29/2005 5:36:00. How can I do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Actually that answer doesn't work. That property is read only.
This should be better then:
DateTime v = DateTime.Now;
v = v.Subtract(new TimeSpan(0,0,0,v.Second,0) );
DateTime v = DateTime.Now;
v = v.Subtract(new TimeSpan(0,0,0,v.Second,0)
ASKER