FormatDateTime() converts a Date value to one of VBScript's named date/time display formats. The actual separators, month/day order and names come from the current regional settings.
FormatDateTime(date[, namedFormat])
Dim my_date, previousLocale
previousLocale = SetLocale(1033) ' English (United States)
my_date = Now
Response.Write FormatDateTime(my_date, vbGeneralDate)
SetLocale previousLocale
7/19/2006 8:38:39 PM
The exact text varies with the locale and regional settings.
| Value | Constant | Meaning |
|---|---|---|
| 0 | vbGeneralDate | Date and/or time using the configured short-date / long-time formats. |
| 1 | vbLongDate | Long regional date. |
| 2 | vbShortDate | Short regional date. |
| 3 | vbLongTime | Long regional time. |
| 4 | vbShortTime | 24-hour hh:mm time. |
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.
| pranajl | 27-12-2012 |
| How to dispalyed Current date & time in ASP program | |