Michael Houston
Michael Houston

Reputation: 3

Changing the default date format in classic asp when using the "date" function

I'm migrating a whole bunch of web pages that were written in classic asp over to a new server, and have discovered many references to the simple date() function, like:

    if cint(left(date,instr(date,"/")-1)) < 9 then blah blah

I'm getting errors because the new server's default date format is returning yyyy-mm-dd, and the code above is expecting it to be in dd/mm/yyyy format.

Rather than manually fixing every occurrence, of which there could be hundreds, I'm looking to see if I can change the default date format for asp so that date() returns dd/mm/yyyy. I thought by simply changing the system's short date format would do the trick, but even after restarting the server it's still showing yyyy-mm-dd.

Is there a setting somewhere where you can specify the default date format when using the date() function?

Upvotes: 0

Views: 3678

Answers (1)

luc
luc

Reputation: 26

This worked for me: change global.asa, in the Sub Session_OnStart, add a line

Session.LCID=1033

Upvotes: 1

Related Questions