FormatDateTime

Format a Date/Time value.

Syntax 
      FormatDateTime(date [,format] )

Key
   date       A date or a string that can be interpreted as a date.
              The values accepted are dependent on the regional settings
              of the current user.
 
   format     The date format: vbGeneralDate (0), vbLongDate (1), vbShortDate (2), vbLongTime (3), vbShortTime (4).

Examples

WScript.Echo FormatDateTime("2012/25/10",vbLongDate)

PowerShell equivalent, using basic format methods for the current date/time:

$result = (get-date).tolongdatestring()
$result = (get-date).toshortdatestring()
$result = (get-date).tolongtimestring()
$result = (get-date).toshorttimestring()

“We all have our time machines. Some take us back, they're called memories. Some take us forward, they're called dreams” ~ Jeremy Irons

Related VBScript commands

FormatCurrency - Format a number with a currency symbol.
FormatNumber - Format a number.
FormatPercent - Format a number with a % symbol.
DatePart - Return part of a given date.
Standard date and time notation - YYYY-MM-DD


 
Copyright © 1999-2025 windevcluster.com
Some rights reserved