Wednesday, August 27, 2008

DateTime ToString Formats

To format a DateTime:
string a = date.ToString("MM/dd/yyyy"); the string will look like "03/02/2008"

You can also do "MMM dd, yyyy", then you will have "Mar 02, 2008". For the entire list of format options, please see http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx.

No comments: