FormatDateTime question

Discussion in 'ASP General' started by fiefie.niles@gmail.com, Apr 7, 2007.

  1. Guest

    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.
    , Apr 7, 2007
    #1
    1. Advertising

  2. Evertjan. Guest

    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)
    Evertjan., Apr 7, 2007
    #2
    1. Advertising

  3. Guest

    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)
    , Apr 7, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sean
    Replies:
    1
    Views:
    568
    Cowboy \(Gregory A. Beamer\)
    Oct 20, 2003
  2. =?Utf-8?B?UnlhbiBTbWl0aA==?=

    Quick Question - Newby Question

    =?Utf-8?B?UnlhbiBTbWl0aA==?=, Feb 14, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    626
    Iain Norman
    Feb 16, 2005
  3. David C

    FormatDateTime

    David C, Oct 16, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    468
    David C
    Oct 17, 2007
  4. Sune

    FormatDateTime

    Sune, Jun 22, 2005, in forum: ASP General
    Replies:
    4
    Views:
    156
  5. FormatDateTime question

    , Apr 7, 2007, in forum: ASP General
    Replies:
    0
    Views:
    104
Loading...

Share This Page