FormatDateTime question

F

fiefie.niles

I set my computer Regional Setting (Control Panel - Regional and
Language Options - Customize - Date) to dd/mm/yy. In my ASP page I do
the following:

FormatDateTime("1/20/07",2)

and it returns 1/20/07 instead of 20/1/07.

I though my setting it to 2, it will display a date using the short
date format specified in your computer's regional settings, how come
it is not ?
How can I set the string to display a date using the computer's
regional setting ?
IIS is running on my machine, I am not on a network, it is just my
machine.

Thank you.
 
E

Evertjan.

wrote on 07 apr 2007 in microsoft.public.inetserver.asp.general:
I set my computer Regional Setting (Control Panel - Regional and
Language Options - Customize - Date) to dd/mm/yy. In my ASP page I do
the following:

FormatDateTime("1/20/07",2)

and it returns 1/20/07 instead of 20/1/07.
I though my setting it to 2, it will display a date using the short
date format specified in your computer's regional settings,

No, not my computer.
ASP FormatDateTime() follows the regional settings of the server(!!)
used.
how come
it is not ?
How can I set the string to display a date using the computer's
regional setting ?
IIS is running on my machine, I am not on a network, it is just my
machine.

I do not know.

My principle is only to use outputs that are independent
of the settings and format them myself.
So no surprises when changing servers:

<% 'vbscript
function myDateFormat(d)
myDateFormat = day(d) & "/" & month(d) & "/" & year(d)
end function

dString = myDateFormat(#2007/01/20#)
nowString = myDateFormat(now)
%>

and never use FormatDateTime(), nor FormatCurrency(),
nor the short version of the year,
and only use the #2007/01/20# string input.
 
F

fiefie.niles

Thank you, that works !


wrote on 07 apr 2007 in microsoft.public.inetserver.asp.general:


No, not my computer.
ASP FormatDateTime() follows the regional settings of the server(!!)
used.


I do not know.

My principle is only to use outputs that are independent
of the settings and format them myself.
So no surprises when changing servers:

<% 'vbscript
function myDateFormat(d)
myDateFormat = day(d) & "/" & month(d) & "/" & year(d)
end function

dString = myDateFormat(#2007/01/20#)
nowString = myDateFormat(now)
%>

and never use FormatDateTime(), nor FormatCurrency(),
nor the short version of the year,
and only use the #2007/01/20# string input.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top