FormatDateTime question

FormatDateTime question

am 07.04.2007 01:37:17 von 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.

Re: FormatDateTime question

am 07.04.2007 10:44:49 von exjxw.hannivoort

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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: FormatDateTime question

am 07.04.2007 18:33:55 von fiefie.niles

Thank you, that works !


On Apr 7, 3:44 am, "Evertjan." wrote:
> 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.
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)