VBScript – How to get TIME or DATE through VBS Script

Description

The FormatDateTime() function creates a formatted date/time string from the supplied date.

FormatDateTime(Date[, Format])

Returns formatted string

[tab:Parameters]

Parameters
The Date parameter must be a formatted date string or a date variant to be formatted.

The optional Format parameter specifies the format to return based on this table.

[tab:Example]

Example

MyDate = FormatDateTime("1-Apr-64", 1)
'contains Wednesday, 1 April 1964

MyDate = FormatDateTime(now, 4)
'contains the time now in short format e.g. 16:24

[tab:END]

SOURCE

LINK

LANGUAGE
ENGLISH