sorry for this trivial question about dates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Lindsay

    #1

    sorry for this trivial question about dates

    I want to put date and time on my web page, and to be sure it tracks the
    BST/ GMT changes.
    Can anyone help me, I have gone back in my historic file for quite a
    while and not found anything.
    Sorry about the newbie trivial question
    --
    David Lindsay
    anti spam in force use reply to address
  • Evertjan.

    #2
    Re: sorry for this trivial question about dates

    David Lindsay wrote on 17 sep 2003 in comp.lang.javas cript:
    [color=blue]
    > I want to put date and time on my web page, and to be sure it tracks the
    > BST/ GMT changes.
    > Can anyone help me, I have gone back in my historic file for quite a
    > while and not found anything.
    > Sorry about the newbie trivial question[/color]

    What do you mean by BST/ GMT changes ?

    Time changes all the time. ;-)

    Do you want the time in GMT/UTC or in west european time?

    Do you want client time or server time ?

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

    Comment

    • Dr John Stockton

      #3
      Re: sorry for this trivial question about dates

      JRS: In article <Xkqc2DFuWMa$Ew VQ@sdresearch.c om>, seen in
      news:comp.lang. javascript, David Lindsay <spam@use.rep ly-to.co.uk>
      posted at Wed, 17 Sep 2003 21:35:58 :-[color=blue]
      >I want to put date and time on my web page, and to be sure it tracks the
      >BST/ GMT changes.
      >Can anyone help me, I have gone back in my historic file for quite a
      >while and not found anything.
      >Sorry about the newbie trivial question[/color]

      Try reading the newsgroup FAQ on the subject of dates and times.

      I assume that you mean the current date and time.

      If you want to be SURE of always being correct, you must yourself
      include the current EU rules for the change, and update whenever
      necessary (unlikely). At least one delivered version of Windows has the
      rules for the UK wrong.

      Putting the current local date & time is a pointless exercise; most OSs
      already show it, most users know the date and can see a proper clock or
      a watch.

      There is a use for showing the current British time to foreigners; for
      example to help Radio 2 listeners sited across the Channel.

      For use in the EU, you only need to apply the correct fixed offset to
      their local time; but for that you need their location, which can be
      adequately deduced from new Date(0).getTime zoneOffset().

      Otherwise, you need to implement the UK Rules, as in js-date5.htm#UKnow
      function BritNow (uses EUch). Note that the UTC of the resulting Object
      must be displayed; UTCDstr is in include3.htm, visible in js-nclds.htm

      If you are only interested in readers whose computer uses UK time, and
      can disregard possible OS errors, display the date object directly, but
      do not use toLocaleString (it is wrong in my browser). Best to supply a
      display routine such as ISOlocalDTstr (/loc cit/).

      You should, of course, point out the dependence on the correctness of
      the viewing computer's time adjustment.

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

      • David Lindsay

        #4
        Re: sorry for this trivial question about dates

        In message <Xns93F9F3CAF8C AFeejj99@194.10 9.133.29>, Evertjan.
        <exjxw.hannivoo rt@interxnl.net > writes[color=blue]
        >David Lindsay wrote on 17 sep 2003 in comp.lang.javas cript:
        >[color=green]
        >> I want to put date and time on my web page, and to be sure it tracks the
        >> BST/ GMT changes.
        >> Can anyone help me, I have gone back in my historic file for quite a
        >> while and not found anything.
        >> Sorry about the newbie trivial question[/color]
        >
        >What do you mean by BST/ GMT changes ?
        >[/color]
        we change from GMT to British summer Time and back again every year[color=blue]
        >
        >Do you want the time in GMT/UTC or in west european time?[/color]

        The actual time in the United Kingdom, as on the server.
        [color=blue]
        >Do you want client time or server time ?
        >[/color]
        TIA
        --
        David Lindsay
        anti spam in force use reply to address

        Comment

        • Evertjan.

          #5
          Re: sorry for this trivial question about dates

          David Lindsay wrote on 19 sep 2003 in comp.lang.javas cript:[color=blue]
          > In message Evertjan wrote[color=green][color=darkred]
          >>> Sorry about the newbie trivial question[/color]
          >>What do you mean by BST/ GMT changes ?[/color]
          > we change from GMT to British summer Time and back again every year[color=green]
          >>Do you want the time in GMT/UTC or in west european time?[/color]
          > The actual time in the United Kingdom, as on the server.[/color]

          Wich is Western European time.
          [color=blue][color=green]
          >>Do you want client time or server time ?[/color]
          > TIA[/color]

          If we are talking client coding:
          If the client machine is correctly configured and has the correct time and is in the UK,
          you can just take the javascript time functions, they are correct.

          =============== =======

          If we are talking server coding and the server has the correct time and is in the UK the
          same applies.

          =============== =======

          if the server is somewhere else, say in Toronto, then you are in trouble. The swich
          times are hours and sometimes a also week apart.

          Serverside ASP javascript can deduct the actual UTC time.
          For correction to Western European Summertime you can add one hour to UTC, but the
          switch moment has to be hardcoded in your code, I presume.

          Not tested, but try it out:

          <script language=javasc ript runat=server>

          summertimestart 03 = Date.UTC(2003,3-1,30,1);
          summertimeend03 = Date.UTC(2003,1 0-1,26,1);
          // see <http://www.npl.co.uk/time/time_summer.htm l>

          d = new Date();
          if((d>summertim estart03)&&(d<s ummertimeend03) )d+=60*60*1000;
          if((d>summertim estart04)&&(d<s ummertimeend04) )d+=60*60*1000;
          if((d>summertim estart05)&&(d<s ummertimeend05) )d+=60*60*1000;
          c = ":";
          s = d.getUTCHours() + c;
          s += d.getUTCMinutes () + c;
          s += d.getUTCSeconds () + c;
          s += d.getUTCMillise conds();

          Response.write( s);

          </script>

          =============== ==========

          see for more help:

          <http://www.merlyn.demo n.co.uk/uksumtim.htm>

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

          Comment

          • Dr John Stockton

            #6
            Re: sorry for this trivial question about dates

            JRS: In article <Xns93FBAB3DCAC A8eejj99@194.10 9.133.29>, seen in
            news:comp.lang. javascript, Evertjan. <exjxw.hannivoo rt@interxnl.net >
            posted at Fri, 19 Sep 2003 14:49:55 :-[color=blue]
            >David Lindsay wrote on 19 sep 2003 in comp.lang.javas cript:[color=green]
            >> In message Evertjan wrote[color=darkred]
            >>>> Sorry about the newbie trivial question
            >>>What do you mean by BST/ GMT changes ?[/color][/color][/color]

            UK civil time is identical to Dutch, except that good Dutch clocks are
            *always* an hour ahead of ours.
            [color=blue][color=green]
            >> we change from GMT to British summer Time and back again every year[color=darkred]
            >>>Do you want the time in GMT/UTC or in west european time?[/color]
            >> The actual time in the United Kingdom, as on the server.[/color]
            >
            >Wich is Western European time.[/color]

            You might call it that; we do not! What do you call the Dutch and
            Graeco-Finnish time zones in Europe?
            [color=blue]
            >if the server is somewhere else, say in Toronto, then you are in trouble. The
            >swich
            >times are hours and sometimes a also week apart.[/color]

            No problem. It's all done somewhere on my site; if Toronto time is not
            New York time (the map in my diary is *small*, just change 5 to 6)
            [color=blue]
            >Serverside ASP javascript can deduct the actual UTC time.
            >For correction to Western European Summertime you can add one hour to UTC, but
            >the
            >switch moment has to be hardcoded in your code, I presume.[/color]

            Indeed not. In js-date5.htm (M=3 or M=10) :

            function EUch(Y, M) { // return ms of Spring/Autumn EU clock change
            var J = Date.UTC(Y, M-1, 31) // last of month is 31st, get UTC
            return J - 864e5*((4+J/864e5)%7) + 36e5 /* Sun, 0100 GMT, ms */ }

            Valid for all years and all of the EU under present rules.

            I've not consolidated the NA code to that extent, but it includes

            var DSTon = (new Date(Date.UTC(Y r, 03, 07, 2-TZ))).toSunday( )
            var DSTof = (new Date(Date.UTC(Y r, 09, 31, 1-TZ))).toSunday( )

            with
            Date.prototype. toSunday = new Function( // back by 0-6 days
            'return new Date(this.setDa te(this.getDate ()-this.getDay())) ')

            For NY (& To?), TZ=-5.

            <URL:http://www.merlyn.demo n.co.uk/js-date5.htm#DDTA> does it for
            anywhere, al long as a suitable TZ string can be provided. Tel Aviv
            might be difficult.

            --
            © 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> JS maths, dates, sources.
            <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.

            Comment

            • Dr John Stockton

              #7
              Re: sorry for this trivial question about dates

              JRS: In article <j5qBxnBsrwa$Ew yz@sdresearch.c om>, seen in
              news:comp.lang. javascript, David Lindsay <must@use.rep ly-to.co.uk>
              posted at Fri, 19 Sep 2003 14:55:56 :-
              [color=blue][color=green]
              >>Do you want the time in GMT/UTC or in west european time?[/color]
              >
              >The actual time in the United Kingdom, as on the server.[/color]

              AIUI, servers generally run on GMT, even in outlandish places like other
              countries, and even in the Summer. It is not a server's business to
              care where its clients are or think they are. AIUI, there is, for
              example, a piece of the British Mainland that operates on Paris time.

              It seems clear that you want to display, to a correctly-set user
              anywhere in the world, the time we use here - UK Civil Time.

              Give or take a quibble about whether UK Civil Time is or should be UTC
              or GMT. I think the best UK clocks show UTC, but legally Summer Time
              starts/stops by GMT. It may have changed.


              function BritNow(Now) { // gives UTC with UK time numbers
              var yr = Now.getUTCFullY ear()
              var EUSTon = EUch(yr, 03), EUSTof = EUch(yr, 10)
              // abroad: add winter TZ offset; update change rules if not EU
              var ms = Now.getTime() // GMT
              if ((ms>=EUSTon) && (EUSTof>ms)) ms += 3600000 // +1h
              return new Date(ms) }

              function TryBritNow() { document.writel n(
              '<table summary="Britis h Date"',
              ' bgcolor=#FFA500 align=center cellpadding=10> ',
              '<tr><td>Page shown at ',
              BritNow(new Date()).UTCDstr (), ' British civil time,',
              ' by your clock.<\/td><\/tr><\/table>') }

              which drives <URL:http://www.merlyn.demo n.co.uk/js-date5.htm#UKNow >.

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

              • Evertjan.

                #8
                Re: sorry for this trivial question about dates

                Dr John Stockton wrote on 19 sep 2003 in comp.lang.javas cript:[color=blue]
                > UK civil time is identical to Dutch, except that good Dutch clocks are
                > *always* an hour ahead of ours.
                >[color=green][color=darkred]
                >>> we change from GMT to British summer Time and back again every year
                >>>>Do you want the time in GMT/UTC or in west european time?
                >>> The actual time in the United Kingdom, as on the server.[/color]
                >>
                >>Wich is Western European time.[/color]
                >
                > You might call it that; we do not! What do you call the Dutch and
                > Graeco-Finnish time zones in Europe?[/color]

                There is no Dutch time zone nowadays!

                Europe ["The union as we know it"] has three time zones:

                Western European Time
                Central European Time
                Eastern European Time

                If you want to call your time "British standard time" or "London time" ot
                "Travalgar square time", so be it, but those are only local names of the
                same, these are leftover names from the time when local time was
                different in each town or count(r)y, and railway time was another time
                again.

                Any question about time zone manipulation code on an internationally used
                NG should address the whole of the time zone and not just such a local
                name.

                I, as an European, am proud the Europen times switches to and from
                summertime (US: daylight saving time) at the same absolute time, 01:00
                UTC, and not like the North American system where the switch ripples
                through the continent, and interstate travel on those nights sould be an
                exact local time loving exentric's nightmare. In eastern British Columbia
                the time zone border runs through the province with roadside notices
                warning you on an very irregular basis. In other places I suppose it is
                the same.
                [color=blue][color=green]
                >>if the server is somewhere else, say in Toronto, then you are in
                >>trouble. The swich times are hours and sometimes also a week apart.[/color][/color]

                The nice thing about serverside javascript is that you can get to UTC
                immediately, or detect the servers time zone difference.

                Serverside vbscript does not have these options, so if you have a server
                in Toronto and want to go to UTC or one of the three European times, you
                would have to incorporate the Toronto local (EST?) switch times.
                [color=blue]
                > No problem. It's all done somewhere on my site; if Toronto time is
                > not New York time (the map in my diary is *small*, just change 5 to 6)
                > [ .... etc ... ][/color]

                That is why I put a link to your site in my posting, John, your solutions
                are by far the most extensive and well tested.


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

                Comment

                • Dr John Stockton

                  #9
                  Re: sorry for this trivial question about dates

                  JRS: In article <Xns93FC6DF79FD 32eejj99@194.10 9.133.29>, seen in
                  news:comp.lang. javascript, Evertjan. <exjxw.hannivoo rt@interxnl.net >
                  posted at Sat, 20 Sep 2003 08:48:24 :-[color=blue]
                  >
                  >I, as an European, am proud the Europen times switches to and from
                  >summertime (US: daylight saving time) at the same absolute time, 01:00
                  >UTC, and not like the North American system where the switch ripples
                  >through the continent, and interstate travel on those nights sould be an
                  >exact local time loving exentric's nightmare. In eastern British Columbia
                  >the time zone border runs through the province with roadside notices
                  >warning you on an very irregular basis. In other places I suppose it is
                  >the same.[/color]

                  There may be problems when the EU eventually fills Europe; that needs
                  another two zones, and if the change remains at 1 am UTC it will in the
                  autumn be at 6 am local time by the Asian Border. And Central European
                  Time will no longer be in the middle; we shall be no better than those
                  who have the Mid-West well to the East of centre.

                  But you may not be quite right in saying that the whole EU changes
                  clocks simultaneously. Brussels has, I agree, said 01:00 UTC; but I
                  think that the corresponding UK document may put the changes at 01:00
                  GMT - which can differ by up to 0.9 seconds.

                  Does anyone know what the 10 (?) about-to-join countries do about Summer
                  Time?

                  -

                  Site editors : mtr -x+ -o/~ *.htm - "this\s+that\s+ tother" lists all
                  files not containing that phrase, whatever the whitespace

                  --
                  © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
                  Web <URL:http://www.merlyn.demo n.co.uk/> - FAQish topics, acronyms, & links.
                  I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
                  free, DOS/Win/UNIX, <URL:http://www.idiotsdelig ht.net/minitrue/> Update soon?

                  Comment

                  • Evertjan.

                    #10
                    Re: sorry for this trivial question about dates

                    Dr John Stockton wrote on 20 sep 2003 in comp.lang.javas cript:[color=blue]
                    > But you may not be quite right in saying that the whole EU changes
                    > clocks simultaneously. Brussels has, I agree, said 01:00 UTC; but I
                    > think that the corresponding UK document may put the changes at 01:00
                    > GMT - which can differ by up to 0.9 seconds.[/color]

                    I certainly doubt that. The UK specs only differ from the rest if it is in
                    the political interest of the uk government to take the trouble, such as in
                    the case of the euro, and 0.9 seconds does not win votes in any local
                    election.

                    Or the legislators did not know of any difference between GMT and UTC.

                    40000000 meter x cos 52deg = 24626459 meters
                    1 day = 86400 seconds
                    1 second = 285 meter
                    0.9 second = 256 meter

                    So the meridian at Greenwich moves a maximum of 256 meters in the maimum
                    time difference between UTC and GMT. That cannot be acepted ! The Eurostar
                    would make a big jump between France and the UK, endangering the many
                    pedestrian illegal immigrants. Talking of tunnel vision.

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

                    Comment

                    • Evertjan.

                      #11
                      Re: sorry for this trivial question about dates

                      Dr John Stockton wrote on 20 sep 2003 in comp.lang.javas cript:
                      [color=blue]
                      > But you may not be quite right in saying that the whole EU changes
                      > clocks simultaneously. Brussels has, I agree, said 01:00 UTC; but I
                      > think that the corresponding UK document may put the changes at 01:00
                      > GMT - which can differ by up to 0.9 seconds.
                      >[/color]

                      UK law 1997:
                      <http://webexhibits.org/daylightsaving/uk.html>

                      EU law 2000:
                      <http://webexhibits.org/daylightsaving/eu.html>

                      Both say GMT !

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

                      Comment

                      • Dr John Stockton

                        #12
                        Re: sorry for this trivial question about dates

                        JRS: In article <Xns93FD86395AE 3eejj99@194.109 .133.29>, seen in
                        news:comp.lang. javascript, Evertjan. <exjxw.hannivoo rt@interxnl.net >
                        posted at Sat, 20 Sep 2003 22:49:11 :-[color=blue]
                        >Dr John Stockton wrote on 20 sep 2003 in comp.lang.javas cript:
                        >[color=green]
                        >> But you may not be quite right in saying that the whole EU changes
                        >> clocks simultaneously. Brussels has, I agree, said 01:00 UTC; but I
                        >> think that the corresponding UK document may put the changes at 01:00
                        >> GMT - which can differ by up to 0.9 seconds.
                        >>[/color]
                        >
                        >UK law 1997:
                        ><http://webexhibits.org/daylightsaving/uk.html>
                        >
                        >EU law 2000:
                        ><http://webexhibits.org/daylightsaving/eu.html>[/color]

                        They are, I believe, American; they are certainly not authoritative; but
                        they may be right.

                        <http://www.dti.gov.uk/er/sumtimetb.htm>, updated 20 March 2003, uses
                        GMT. It links to <http://europa.eu.int/smartapi/cgi/sga_doc?smartap i!ce
                        lexapi!prod!CEL EXnumdoc&lg=EN& numdoc=32000L00 84&model=guiche tt> of 19
                        January 2001 which uses GMT. Those are authoritative.

                        But <http://www.merlyn.demo n.co.uk/uksumtim.htm> has noted that
                        "Statements about the EU rules are derived from the English version
                        (which uses GMT; others do not)."

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

                        • Evertjan.

                          #13
                          Re: sorry for this trivial question about dates

                          Dr John Stockton wrote on 21 sep 2003 in comp.lang.javas cript:[color=blue][color=green]
                          >>UK law 1997:
                          >><http://webexhibits.org/daylightsaving/uk.html>
                          >>
                          >>EU law 2000:
                          >><http://webexhibits.org/daylightsaving/eu.html>[/color]
                          >
                          > They are, I believe, American; they are certainly not authoritative;
                          > but they may be right.
                          >
                          > <http://www.dti.gov.uk/er/sumtimetb.htm>, updated 20 March 2003, uses
                          > GMT. It links to
                          > <http://europa.eu.int/smartapi/cgi/sga_doc?smartap i!ce
                          > lexapi!prod!CEL EXnumdoc&lg=EN& numdoc=32000L00 84&model=guiche tt> of 19
                          > January 2001 which uses GMT. Those are authoritative.
                          >
                          > But <http://www.merlyn.demo n.co.uk/uksumtim.htm> has noted that
                          > "Statements about the EU rules are derived from the English version
                          > (which uses GMT; others do not)."[/color]

                          Such laws or regulations should refer to UTC, IMHO.

                          On the other hand, is the exactness of legal local time within one
                          second that important?

                          Any serious scientific time measurement on that level of tolerance
                          should be in UTC.

                          Imagine a police officer saying: "You are not using your headlights at
                          night and it night since is 0.9 seconds". That would be zero-tolerance !


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

                          Comment

                          Working...