Question

i am doing this work using classic asp on webmatrix

in my database the dates stored are in the format mm/dd/yyyy

when i write those on a webpage the dates change format and become dd/mm/yyyy

also the fact that different users might have their system date format in different ways. Is there is a way to bypass that and get and show date in a fixed format.

appreciate your help and time

Vin

Was it helpful?

Solution

You infered well, ASP more accurately The ASP engine in your web server (IIS) is converting imlpicitily all your date values, based on the system regional settings in your Server.

Doesn't matter in which format do you have stored the date values in the database, ASP will allways convert it all. Exists two altenatives to correct this:

the use of LCID property

The LCID property specifies how dates, times, and currencies are formatted. Locale identifiers (LCIDs) are not the same for each geographical locale. Some locales format dates as YY-MM-DD, and some format dates as MM-DD-YYYY. The LCID property is read/write.

The LCID is supported in Session and in Response (this only supported in recent versions of windows) Object.

depending where you live or where your clients are from you can choose the LCID more appropiated to them in this list of LCID Numbers

More Information:

MSDN - Response.LCID

MSDN - Session.LCID

change the regional settings in your server

check this thread for more information

ASP Classic & SQL date out-of-range error

(check the quick fix part)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top