View Full Version : All Digits of Date Needed For: Response.Write Date

02-04-2003, 05:23 PM
If I want to output the current date of 02/04/2003 and use "Date" as the command it will output 2/4/2003.

Is there a way to force for the fully qualified date?

02-04-2003, 05:46 PM
FormatDatetTime() or DateSerial() ought to cover however you need to format it.


02-04-2003, 06:56 PM
The leading zeroes are always parsed... ;(

The only thing that I can think of doing is writing an elaborate function to fill them in based on the position and month number...

Any other suggestions?

Thanks in advance!

02-05-2003, 01:31 AM
try changing the date format in the Regional Settings properties of the server.

02-05-2003, 06:28 AM
You can always split it up...

mydatearray = Split("2/4/2003","/")
mynewdate = Right("00" & mydatearray(0),2) & "/" & Right("00" & mydatearray(1),2) & "/" & mydatearray(2)

That will stick the correct number of leading zeroes in there (in this case, filling up 2 places).

I often use code like this to format export script which will be sent to a client's AS/400 database which requires leading zeroes, since it eliminates the need for any elaborate function such as you mentioned. ;)

02-07-2003, 07:18 PM

It did work but upon refresh this is the error message:

Error Type:
Microsoft VBScript runtime (0x800A000A)
This array is fixed or temporarily locked
file.asp, line 216

Can someone tell me the best method to avoid this error?


02-07-2003, 11:25 PM
Hmm, I'm not sure what's causing that, that's a totally new error on me!

Perhaps it's the variable you're splitting. Perhaps assign that string to another temporary variable?!?

mytempdate = "2/4/2003"
mydatearray = Split(mytempdate,"/")
mynewdate = Right("00" & mydatearray(0),2) & "/" & Right("00" & mydatearray(1),2) & "/" & mydatearray(2)

02-11-2003, 03:50 PM
That was all that it took to solve the problem.

For what ever reason I would get type mismatch when I tried before; however it now works and it is an excellent solution to what I was after rather than creating an awefully ugly function/sub!!!