Method: FormatDateTime for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: FormatDateTime for VBS
Method: FormatDateTime for VBS
Formats a date or time expression.
vFormatDateTime = Object.FormatDateTime(Date, [NamedFormat])
| Object | VBS Object with this method. You do not need to specify this object. |
| Date | Variant Specifies the date or time expression you want to format. |
| [NamedFormat] | Variant Specifies the date and time format. Possible settings include vbGeneralDate, vbLongDate, vbShortDate, vbLongTime, and vbShortTime. If you do not specify a value, the FormatDateTime method uses the vbGeneralDate setting. |
| vFormatDateTime | Variant Receives the formatted date or time expression. |
The following example displays the current date and the current time:
Call MsgBox(FormatDateTime(Now, vbGeneralDate))