Format date and time with FormatDateTime()

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.

Syntax

FormatDateTime(date[, namedFormat])

Format the current date and time

Dim my_date, previousLocale
previousLocale = SetLocale(1033) ' English (United States)
my_date = Now
Response.Write FormatDateTime(my_date, vbGeneralDate)
SetLocale previousLocale

Example output

7/19/2006 8:38:39 PM

The exact text varies with the locale and regional settings.

Named formats

ValueConstantMeaning
0vbGeneralDateDate and/or time using the configured short-date / long-time formats.
1vbLongDateLong regional date.
2vbShortDateShort regional date.
3vbLongTimeLong regional time.
4vbShortTime24-hour hh:mm time.
Display vs storage: formatting changes the displayed string, not the underlying Date value. Keep Date values as dates for comparisons and database operations; format only when presenting them to users.

ASP Home



pranajl

27-12-2012

How to dispalyed Current date & time in ASP program



✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer