Learn as much as you can about the climate crisis.
Then put your knowledge into action. www.climatecrisis.net
| Codes | Output | 
|---|---|
| Format(Now, "h") | System.FormatException was unhandled Input string was not in a correct format. | 
| FormatDateTime(Now, DateFormat.ShortTime) | 19:36 (in 24 hour) | 
| DateTime.Now.ToString("h") or Now.ToString(" h") | 7 (in 12 hour) | 
| Now.Hour.ToString(" h") | h (not appear figure in hour) | 
Formatting Dates and Times
A format string for date/time values can use one of the predefined string values shown in the following table.
| String | Description | 
|---|---|
| Long DateD | Displays a date in long date format. | 
| Short Dated | Displays a date in short date format. | 
| Long TimeT | Displays a date in long date format. | 
| Short Timet | Displays a date in short date format. | 
| F | Displays the long date and long time. | 
| f | Displays the long date and short time. | 
| g | Displays the short date and short time. | 
| Mm | Displays the month and the day of a date. | 
| Yy | Formats the date as the year and month. | 
Examples of applying a format string to date/time values are shown in the following table.
| Format | Output | 
|---|---|
| Format(Now,"D") | Thursday, November 29, 2007 | 
| Format(Now,"d") | 11/29/2007 | 
| Format(Now,"T") | 3:20:02 AM | 
| Format(Now,"t") | 3:20 AM | 
| Format(Now,"F") | Thursday, November 29, 2007 3:20:02 AM | 
| Format(Now,"f") | Thursday, November 29, 2007 3:20 AM | 
| Format(Now,"g") | 11/29/2007 3:20 AM | 
| Format(Now,"m") | November 29 | 
| Format(Now,"y") | November, 2007 |