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 |
No comments:
Post a Comment