Besides the DateTime ctor (new DateTime(year, month, day)) , is there any other way to truncate a date?
+2
A:
DateTime.Now.ToShortDateString();
Also, ToString() is overloaded in DateTime, you can pass a few dozen formatting options to it.
See: http://authors.aspalliance.com/aspxtreme/sys/demos/datetimeformats.aspx
FlySwat
2008-10-31 03:00:17
I'm disappointed in you Jon. I've come to expect better from you! Hey - check out my answer to the Asynchronous Linq question. Pretty sweet.
TheSoftwareJedi
2008-10-31 03:06:50
Meh, I just misunderstood what he was asking for. I thought he wanted to know how to format its output to not contain time info, not that he wanted a date object with no time.
FlySwat
2008-10-31 03:08:14
Jon - saw your comment on the other answer. You're forgiven. I hate when people do that.
TheSoftwareJedi
2008-10-31 03:08:24
Its all good Dana.
FlySwat
2008-10-31 03:11:20