Date Range for Date Function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dennis M. Marks

    #1

    Date Range for Date Function

    What is the maximum valid date range for the date(yyyy,mm,dd ) function.

    --
    Dennis M. Marks

    Replace domain.invalid with dcsi.net


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  • Dr John Stockton

    #2
    Re: Date Range for Date Function

    JRS: In article <12042004155443 2353%denmarks@d omain.invalid>, seen in
    news:comp.lang. javascript, Dennis M. Marks <denmarks@domai n.invalid>
    posted at Mon, 12 Apr 2004 15:54:43 :
    [color=blue]
    >What is the maximum valid date range for the date(yyyy,mm,dd ) function.[/color]

    AFAICS, no such function exists. The function Date(...) appears to
    exist, and may be equivalent to new Date() . I've not checked ECMA-
    262; you can do that.

    However, new Date(Y, M', D) exists.

    It is valid from -271821-04-20 to 275760-09-12 GMT, I believe, but,
    depending on interpretation, omitting years 0 to 99.

    You could have discovered that by using the newsgroup FAQ.

    D = new Date(0) ; D.setFullYear(Y , M', D)
    D = new Date(0) ; D.setUTCFullYea r(Y, M', D)
    treat the First Century as it ought to be treated.

    --
    © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
    <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
    <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
    <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

    Comment

    • Dennis M. Marks

      #3
      Re: Date Range for Date Function

      In article <aekabrBHwXfAFw xP@merlyn.demon .co.uk>, Dr John Stockton
      <spam@merlyn.de mon.co.uk> wrote:
      [color=blue]
      > JRS: In article <12042004155443 2353%denmarks@d omain.invalid>, seen in
      > news:comp.lang. javascript, Dennis M. Marks <denmarks@domai n.invalid>
      > posted at Mon, 12 Apr 2004 15:54:43 :
      >[color=green]
      > >What is the maximum valid date range for the date(yyyy,mm,dd ) function.[/color]
      >
      > AFAICS, no such function exists. The function Date(...) appears to
      > exist, and may be equivalent to new Date() . I've not checked ECMA-
      > 262; you can do that.
      >
      > However, new Date(Y, M', D) exists.
      >
      > It is valid from -271821-04-20 to 275760-09-12 GMT, I believe, but,
      > depending on interpretation, omitting years 0 to 99.
      >
      > You could have discovered that by using the newsgroup FAQ.
      >
      > D = new Date(0) ; D.setFullYear(Y , M', D)
      > D = new Date(0) ; D.setUTCFullYea r(Y, M', D)
      > treat the First Century as it ought to be treated.[/color]

      Why can't you give direct answers? You knew I was referring to date
      functions and just because I had lower case rather than upper case in
      my question is no reason to act as you do. Why don't you get off your
      high horse?

      I went to www.faqs.org to find the FAQ and it referred to a website
      that does not exist. Where are the FAQs?

      Since the Gregorian calendar began 15 October 1582, I wanted to know
      what dates were valid for the function. The date -271821-04-20 does not
      exist in the Gregorian calendar. Does the function change to the Julian
      calendar prior to that date? What happens to the days that don't exist
      due to the calendar change?

      What would be nice to know is the algorithm that the date function uses
      to calculate day of week.

      --
      Dennis M. Marks

      Replace domain.invalid with dcsi.net


      -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
      http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
      -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: Date Range for Date Function

        "Dennis M. Marks" <denmarks@domai n.invalid> writes:
        [color=blue]
        > I went to www.faqs.org to find the FAQ and it referred to a website
        > that does not exist. Where are the FAQs?[/color]

        It is posted every week (twice?) in the newsgroup. Since you seem to
        be a regular reader, you will probably have seen the subject several
        times.
        It is also available on the web at
        <URL: http://jibbering.com/faq/ >
        [color=blue]
        > What would be nice to know is the algorithm that the date function uses
        > to calculate day of week.[/color]

        It's described in ECMA 262 v3, section 15.9. It is available as PDF
        from, e.g., <URL:http://www.mozilla.org/js/language/E262-3.pdf>
        Day of Week in particular is section 15.9.1.6.
        For the time value t, the week day is
        WeekDay(t) = ((floor(t / 864E5)) + 4) modulo 7
        where t=0 is 1st of January 1970 UTC.

        /L
        --
        Lasse Reichstein Nielsen - lrn@hotpop.com
        DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
        'Faith without judgement merely degrades the spirit divine.'

        Comment

        • Dennis M. Marks

          #5
          Re: Date Range for Date Function

          In article <n05ef66f.fsf@h otpop.com>, Lasse Reichstein Nielsen
          <lrn@hotpop.com > wrote:
          [color=blue]
          > "Dennis M. Marks" <denmarks@domai n.invalid> writes:
          >[color=green]
          > > I went to www.faqs.org to find the FAQ and it referred to a website
          > > that does not exist. Where are the FAQs?[/color]
          >
          > It is posted every week (twice?) in the newsgroup. Since you seem to
          > be a regular reader, you will probably have seen the subject several
          > times.
          > It is also available on the web at
          > <URL: http://jibbering.com/faq/ >
          >[color=green]
          > > What would be nice to know is the algorithm that the date function uses
          > > to calculate day of week.[/color]
          >
          > It's described in ECMA 262 v3, section 15.9. It is available as PDF
          > from, e.g., <URL:http://www.mozilla.org/js/language/E262-3.pdf>
          > Day of Week in particular is section 15.9.1.6.
          > For the time value t, the week day is
          > WeekDay(t) = ((floor(t / 864E5)) + 4) modulo 7
          > where t=0 is 1st of January 1970 UTC.
          >
          > /L[/color]
          Thank you.

          --
          Dennis M. Marks

          Replace domain.invalid with dcsi.net


          -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
          http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
          -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

          Comment

          • Dr John Stockton

            #6
            Re: Date Range for Date Function

            JRS: In article <14042004163447 3147%denmarks@d omain.invalid>, seen in
            news:comp.lang. javascript, Dennis M. Marks <denmarks@domai n.invalid>
            posted at Wed, 14 Apr 2004 16:34:47 :[color=blue]
            >In article <aekabrBHwXfAFw xP@merlyn.demon .co.uk>, Dr John Stockton
            ><spam@merlyn.d emon.co.uk> wrote:
            >[color=green]
            >> JRS: In article <12042004155443 2353%denmarks@d omain.invalid>, seen in
            >> news:comp.lang. javascript, Dennis M. Marks <denmarks@domai n.invalid>
            >> posted at Mon, 12 Apr 2004 15:54:43 :
            >>[color=darkred]
            >> >What is the maximum valid date range for the date(yyyy,mm,dd ) function.[/color]
            >>
            >> AFAICS, no such function exists. The function Date(...) appears to
            >> exist, and may be equivalent to new Date() . I've not checked ECMA-
            >> 262; you can do that.
            >>
            >> However, new Date(Y, M', D) exists.
            >>
            >> It is valid from -271821-04-20 to 275760-09-12 GMT, I believe, but,
            >> depending on interpretation, omitting years 0 to 99.
            >>
            >> You could have discovered that by using the newsgroup FAQ.
            >>
            >> D = new Date(0) ; D.setFullYear(Y , M', D)
            >> D = new Date(0) ; D.setUTCFullYea r(Y, M', D)
            >> treat the First Century as it ought to be treated.[/color][/color]


            [color=blue]
            >I went to www.faqs.org to find the FAQ and it referred to a website
            >that does not exist. Where are the FAQs?[/color]

            I did not write "the FAQs", but "the newsgroup FAQ". The newsgroup FAQ
            is posted here on Mondays, Wednesdays, and Fridays (in two parts), and
            was cited in the signature of my previous article (when I refer to the
            FAQ, that is generally the case). By now, you should have noticed it -
            indeed, you should have read it.

            aside: Anyone know the source of the Snow quotation along the
            lines of "I don't day that he should have written a
            book; I do say that he should have read one." ?

            [color=blue]
            >Since the Gregorian calendar began 15 October 1582, I wanted to know
            >what dates were valid for the function. The date -271821-04-20 does not
            >exist in the Gregorian calendar.[/color]

            Indeed it does; the proleptic Gregorian Calendar runs indefinitely
            backwards from the local change date, and is used in javascript, which,
            as distributed, knows nothing of the Julian calendar (see my js-date.htm
            for some Julian date methods). Date methods accepting numeric years
            follow (apparently reliably), the astronomical convention, in which the
            Year 1 is preceded by the years 0, -1, -2, ...

            [color=blue]
            >Does the function change to the Julian
            >calendar prior to that date? What happens to the days that don't exist
            >due to the calendar change?[/color]

            No; therefore there are no such days.

            If javascript attempted to deal with calendar changes; it would be in
            great difficulties as regards the Alaskan calendar for 1867 - and even
            more so for the Saudi calendar.

            It would also need to consider the time of the change (our American
            Colonies did not make the change at the same instant as His Majesty did
            here; though they did make it at the same time), and the possible
            influence of the Summer Time rules.


            [color=blue]
            >What would be nice to know is the algorithm that the date function uses
            >to calculate day of week.[/color]

            Given the wisdom of the average systems programmer in the relevant
            country, it's hard to predict what algorithm might be used. As the date
            object stores date/time as a count, the sensible method is based on
            modulo-7. ECMA gives an algorithm; but it's somewhat of a /post hoc/
            document, and the only requirement is that the results should agree with
            that.

            --
            © 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

            • Dr John Stockton

              #7
              Re: Date Range for Date Function

              JRS: In article <n05ef66f.fsf@h otpop.com>, seen in
              news:comp.lang. javascript, Lasse Reichstein Nielsen <lrn@hotpop.com >
              posted at Thu, 15 Apr 2004 02:14:48 :[color=blue]
              >"Dennis M. Marks" <denmarks@domai n.invalid> writes:
              >[color=green]
              >> I went to www.faqs.org to find the FAQ and it referred to a website
              >> that does not exist. Where are the FAQs?[/color]
              >
              >It is posted every week (twice?) in the newsgroup. Since you seem to
              >be a regular reader, you will probably have seen the subject several
              >times.
              >It is also available on the web at
              > <URL: http://jibbering.com/faq/ >
              >[color=green]
              >> What would be nice to know is the algorithm that the date function uses
              >> to calculate day of week.[/color]
              >
              >It's described in ECMA 262 v3, section 15.9. It is available as PDF
              >from, e.g., <URL:http://www.mozilla.org/js/language/E262-3.pdf>
              >Day of Week in particular is section 15.9.1.6.
              >For the time value t, the week day is
              > WeekDay(t) = ((floor(t / 864E5)) + 4) modulo 7
              >where t=0 is 1st of January 1970 UTC.[/color]


              ECMA 15.9 is not well-written. Up to and including 15.9.1.6, it uses
              exclusively UTC, although referring to such as Year Month Day which are
              normally thought of as changing in or near the middle of the local
              darkness.

              15.9.1.7 is missing.

              15.9.1.8 introduces local time.

              15.9.1.9-the-first introduces Summer time, and
              15.9.1.9-the-second describes local <-> UTC conversion.

              The *actual* algorithm for getDay is in 15.9.5.16, which uses 15.9.1.9-
              the-second as well as 15.9.1.6.



              <URL:http://www.merlyn.demo n.co.uk/js-date3.htm#KSTR> (was #STR), part
              "Set a Date Object", needs thoughtfully checking by a European whose
              browser uses the correct EU Summer Time rules ...

              --
              © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
              Web <URL:http://www.merlyn.demo n.co.uk/> - FAQqish topics, acronyms & links;
              some Astro stuff via astro.htm, gravity0.htm; quotes.htm; pascal.htm; &c, &c.
              No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

              Comment

              • John G Harris

                #8
                Re: Date Range for Date Function

                In article <14042004163447 3147%denmarks@d omain.invalid>, Dennis M. Marks
                <denmarks@domai n.invalid> writes

                <snip>[color=blue]
                >Since the Gregorian calendar began 15 October 1582, I wanted to know
                >what dates were valid for the function. The date -271821-04-20 does not
                >exist in the Gregorian calendar. Does the function change to the Julian
                >calendar prior to that date? What happens to the days that don't exist
                >due to the calendar change?[/color]

                No. I'm afraid you need to think clearly about calendars and dates and
                days. A calendar gives names (or numbers) to days. There are many
                calendars. Which one it's best to use depends on circumstances and on
                who you're talking to.

                For instance, the Russian revolution started in October 1914 when Russia
                was using the Julian calendar, and its anniversaries were celebrated in
                November because Russia later adopted the Gregorian calendar. It's still
                called the October revolution.

                Use of the Gregorian calendar may have started in 1582, but that
                calendar names days as far into the past and as far into the future as
                it's sensible to talk about "days". (I.e. Billions of years).

                Another complication if you want to be historically accurate is that
                until fairly recently the year number changed on March 25 (Julian), not
                on Jan 1. That's why the English tax year starts on April 6 (Gregorian).
                [color=blue]
                >What would be nice to know is the algorithm that the date function uses
                >to calculate day of week.[/color]

                Many modern browsers do what ECMA 262 says. Older ones might be
                different.

                John
                --
                John Harris

                Comment

                • Dr John Stockton

                  #9
                  Re: Date Range for Date Function

                  JRS: In article <rQilg9CRvufAFw Hu@jgharris.dem on.co.uk>, seen in
                  news:comp.lang. javascript, John G Harris <john@nospam.de mon.co.uk>
                  posted at Thu, 15 Apr 2004 21:08:49 :
                  [color=blue]
                  >For instance, the Russian revolution started in October 1914 when Russia
                  >was using the Julian calendar, and its anniversaries were celebrated in
                  >November because Russia later adopted the Gregorian calendar. It's still
                  >called the October revolution.[/color]

                  While they were usually revolting, this particular October was in 1917.
                  The Octobrists, however, refers to 1905.

                  [color=blue]
                  >Another complication if you want to be historically accurate is that
                  >until fairly recently the year number changed on March 25 (Julian), not
                  >on Jan 1. That's why the English tax year starts on April 6 (Gregorian).[/color]

                  In part.

                  When England used the Julian Calendar, taxpayers were naturally granted,
                  *every* fourth year, an extra day between tax-due dates.

                  In the 1750s, March 25 Julian was April 5 Gregorian (difference 11
                  days), so the start of the tax year did not change, but was re-labelled
                  April 5th.

                  When a Leap Day was omitted in 1800 under the Gregorian Rules, the then-
                  considerate (or cowardly) authorities granted the customary extra day by
                  shifting the date to April 6th; alas, in 1900 this due boon was not
                  granted. Or so I believe.

                  --
                  © 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...