datetime class : ToString(string) method
Description
Gets a string representation that is formatted with the specified format.
Syntax
datetimeInstance.ToString(string format)
Arguments
Class | Name | Description |
string | format | format |
Return value
Class | Description |
string | A formatted string representation. |
Sample code
1: | datetime dt = new datetime("2013/12/14 10:10:9"); |
2: | string formedString = dt.ToString("MMM dd, yyyy"); // 12 14, 2013 |
Notes
It's a wrapper of the System.DateTime.ToString(String) method.