Question : Missing day no. when using FormatDateTime

After moving a classic ASP website to another server, there appears to be a problem with LONG DATE formatting in that it only (e.g.) “Monday February 2010”
See the code for two tests that demonstrates a difference in results
Long date formatting in Regional Settings is ‘dd mmmmmm yyyy’.
Any suggestions?!

Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim dtDate
dtDate = Now()
response.write "UNFORMATTED: " & dtDate & "
" response.write "GENERAL DATE(0) " & FormatDateTime(dtDate, 0) & "
" response.write "LONG DATE(1) " & FormatDateTime(dtDate, 1) & "
" response.write "SHORT DATE(2) " & FormatDateTime(dtDate, 2) & "
" response.write "LONG TIME(3) " & FormatDateTime(dtDate, 3) & "
" response.write "SHORT TIME(4) " & FormatDateTime(dtDate, 4) & "
" response.end %> OUTPUT: UNFORMATTED: 15/02/2010 19:11:57 GENERAL DATE(0) 15/02/2010 19:11:57 LONG DATE(1) Monday February 2010 SHORT DATE(2) 15/02/2010 LONG TIME(3) 19:11:57 SHORT TIME(3) 19:11 Whereas; this example works correctly: OUTPUT: 15/02/2010 19:17:41 0 15/02/2010 19:17:41 1 15 February 2010 2 15/02/2010 3 19:17:41 4 19:17

Answer : Missing day no. when using FormatDateTime

Hi

The first section of code you have there is server side so uses the servers regional settings. (The long date suggests regional setting of dddd MMMM yyyy)

The second section of code is client side so uses the local PC regional settings. (The long date suggests regional setting of dd MMMM yyyy)

This could explain why you get different results in your example above but not why it changed when you moved the site to a new server.

Have you compared the regional settings on both servers and your pc?

Regards

Scott
Random Solutions  
 
programming4us programming4us