Date formatting

Discussion in 'Javascript' started by Trev@Work, Jul 30, 2004.

  1. Trev@Work

    Trev@Work Guest

    Is there a way to format a date to the current user's country settings?
    The date I post from the Date() function (Mozilla/JavaScript) is
    incomprehensible by the back-end application (ASP/VBScript).
     
    Trev@Work, Jul 30, 2004
    #1
    1. Advertising

  2. Trev@Work

    Grant Wagner Guest

    "Trev@Work" wrote:

    > Is there a way to format a date to the current user's country settings?
    > The date I post from the Date() function (Mozilla/JavaScript) is
    > incomprehensible by the back-end application (ASP/VBScript).


    Use a date format both the client and the server are sure not to
    misinterpret:

    YYYYMMDD[HH[MM[SS]]]

    --
    Grant Wagner <>
    comp.lang.javascript FAQ - http://jibbering.com/faq
     
    Grant Wagner, Jul 30, 2004
    #2
    1. Advertising

  3. JRS: In article <410a3946$0$9461$>, dated
    Fri, 30 Jul 2004 13:04:17, seen in news:comp.lang.javascript, Trev@Work
    <no.email@please.?> posted :

    >Is there a way to format a date to the current user's country settings?
    >The date I post from the Date() function (Mozilla/JavaScript) is
    >incomprehensible by the back-end application (ASP/VBScript).


    Methods toString & toLocaleString may do it.

    The settings accepted by the back end, if in some way national, do not
    necessarily include all of those that the front-end users may have
    selected.

    There is known to be one American, for example, who uses YYYY-MM-DD;
    there may be others who comply with FIPS, their Federal Standard.

    If your back end can receive a time_t, then that might be the best to
    use, since javascript holds date/time in that form - if D is the Date
    Object, just send D.getTime() . The present value is a little under
    1091232000.

    Ideal standards include YYYYMMDDhhmmss & YYYY-MM-DDThh:mm:ss ;
    YYYY/MM/DD hh:mm:ss might be acceptable.

    Consider carefully the effects of your local offset from GMT or UTC.

    --
    © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
    Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
    PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
    Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
     
    Dr John Stockton, Jul 30, 2004
    #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. Matt
    Replies:
    1
    Views:
    645
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,361
    Michael Borgwardt
    May 30, 2004
  3. Matt
    Replies:
    2
    Views:
    565
    Pete Becker
    Nov 8, 2003
  4. Matt
    Replies:
    3
    Views:
    754
    Richard Heathfield
    Nov 8, 2003
  5. Matt
    Replies:
    11
    Views:
    425
    Aaron Bertrand [MVP]
    Nov 8, 2003
Loading...

Share This Page