Friday, July 19, 2013

casting a DateTime to a string in C#

dt.ToString("yyyy-MM-dd");

Is an example per this. While this suggests the hours, minutes, seconds, milliseconds, and antemeridian-versus-postmeridian stuff may be expressed like:

dt.ToString("hh:mm:ss.fff tt");

No comments:

Post a Comment