Date - VBScript


Date is a VB Script command that returns the current system date and time in a customizable format. It is commonly used for formatting dates, obtaining timestamps, and manipulating date values.




  • Format: (Optional) A formatting string that determines the output format of the date. If omitted, the default format will be used.


No options or flags are available for the Date command.


Simple Example:

Dim myDate
myDate = Date

WScript.Echo "Current date:" & myDate

Customized Format:

Dim myDate
myDate = Date("dd/MM/yyyy hh:mm:ss")

WScript.Echo "Current date (customized format):" & myDate

Timestamp Generation:

Dim timeStamp
timeStamp = Date("yyyyMMddhhmmss")

WScript.Echo "Timestamp:" & timeStamp

Common Issues

Incorrect Formatting String:

Ensure that the formatting string you provide matches the correct syntax and format options.


The Date command can be integrated with other VB Script commands or tools for advanced date manipulation tasks, such as:

  • DateAdd: Adding a specified time interval to a date.
  • DateDiff: Calculating the difference between two dates.
  • DatePart: Extracting specific date components (e.g., year, month, day).
  • FormatDateTime: Formats a date value using a custom format string.
  • Now: Returns the current date and time as a Date object.
  • Timer: Returns the current time as a time value.