Date formatting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Trev@Work

    Date formatting

    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
    incomprehensibl e by the back-end application (ASP/VBScript).
  • Grant Wagner

    #2
    Re: Date formatting

    "Trev@Work" wrote:
    [color=blue]
    > 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
    > incomprehensibl e by the back-end application (ASP/VBScript).[/color]

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

    YYYYMMDD[HH[MM[SS]]]

    --
    Grant Wagner <gwagner@agrico reunited.com>
    comp.lang.javas cript FAQ - http://jibbering.com/faq

    Comment

    • Dr John Stockton

      #3
      Re: Date formatting

      JRS: In article <410a3946$0$946 1$afc38c87@news .easynet.co.uk> , dated
      Fri, 30 Jul 2004 13:04:17, seen in news:comp.lang. javascript, Trev@Work
      <no.email@pleas e.?> posted :
      [color=blue]
      >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
      >incomprehensib le by the back-end application (ASP/VBScript).[/color]

      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.demo n.co.uk/> - w. FAQish topics, links, acronyms
      PAS EXE etc : <URL:http://www.merlyn.demo n.co.uk/programs/> - see 00index.htm
      Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.

      Comment

      Working...