Announcement

Collapse
No announcement yet.

Daylight Savings Time Date

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Daylight Savings Time Date

    Looking for a Sample/Idea(s) on a routine for getting the date
    Daylight Savings Time begins and Ends, the 1st Sunday in April
    & the 3rd Sunday in October.
    I've looked at dateunit.bas & I've searched this forum.
    I'd like to input the Year%/$ (2000) and return the two dates,
    DSTDate$, (04-02-2000) & STDate$, (10-22-2000).
    Thanks - Rick

  • #2
    Richard,

    Somewhere I must have a couple of functions that find the Daylight Savings period for the European Community (last Sunday of March until last Sunday of October). If I can find them you will see them here ASAP (maybe even modified for the US-situation).

    In the meantime, be aware of the fact that the easiest way to use them is to convert calendar dates into Julian Day Numbers. See my pages at http://www.basicguru.com/zijlema/ to find out how this can be used.

    Regards,
    Egbert

    ------------------


    [This message has been edited by Egbert Zijlema (edited March 23, 2000).]

    Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
    http://zijlema.basicguru.eu
    *** Opinions expressed here are not necessarily untrue ***

    Comment


    • #3
      The source code is in the source code section now. It works for both regions, America and Europe.

      [This message has been edited by Egbert Zijlema (edited March 24, 2000).]

      Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
      http://zijlema.basicguru.eu
      *** Opinions expressed here are not necessarily untrue ***

      Comment


      • #4
        Egbert
        Thank you, I did mess up, but a little worse than you anticipated,
        it appears as though its the LAST Sunday in October.
        I'm looking at your function DaylightEnd(), LOOP UNTIL sunday =
        4, I'm not sure what to do, but a little hacking could be fun,
        thanks again... - Rick

        ------------------

        Comment


        • #5
          Right, the last Sunday is not always the 4th Sunday.

          How about starting with the following month (April or November) and counting backwards until Day = Sunday?

          -- Eric

          ------------------
          Perfect Sync: Perfect Sync Development Tools
          Email: mailto:[email protected][email protected]</A>

          "Not my circus, not my monkeys."

          Comment


          • #6
            Richard, are you only interested in determining Daylight Savings transition dates for the US or for any country? I have a hard copy of a web page (that is unfortunately no longer available) which lists daylight savings transition rules for every country that uses it (except Australia) and is correct as at January 1998. I can e-mail it to you if you are interested.
            If you try to make something idiot-proof, someone will invent a better idiot.

            Comment


            • #7
              Rick,

              The last Sunday of October is easy. Change DayLightEnd as follows:

              Code:
              FUNCTION DaylightEnd(BYVAL year AS INTEGER) AS LONG
                LOCAL start&
                start& = Julian(year, 11, 1)               ' November 1
                DO
                  DECR start&                              ' DECREASE!
                LOOP UNTIL start& MOD 7 = 6                ' final Sun of Oct
                FUNCTION = start&
              END FUNCTION

              ------------------


              [This message has been edited by Egbert Zijlema (edited March 23, 2000).]

              Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
              http://zijlema.basicguru.eu
              *** Opinions expressed here are not necessarily untrue ***

              Comment


              • #8
                Thanks Eric,

                Mathew if its not too much trouble, I am interested, don't think
                I'll need it for this application however, [email protected]

                Thanks again - Rick

                ------------------

                Comment


                • #9
                  Matthew,
                  I'm interested. Please e-mail the stuff to [email protected]

                  And now my question on this subject. It's simple to adjust the time on the first Daylight Savings day. Officially it should be done at 02:00 AM. Because the adjustment is an advancement it will never be 2 o'clock again that night.

                  But what in October? At 3 AM the clock is set back to 2 AM. After one hour it's 3 AM again, and again, and again.... Who has a solution?

                  Thanks,
                  Egbert

                  ------------------

                  Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
                  http://zijlema.basicguru.eu
                  *** Opinions expressed here are not necessarily untrue ***

                  Comment


                  • #10
                    Can't you just use a boolean flag to indicate whether or not you have already updated the system time?

                    Interestingly, I note that the RTC's Status Register B has an "Automatic Daylight Savings Adjust" boolean flag although most of the PCs I've seen don't have a CMOS option to turn this feature on/off.
                    If you try to make something idiot-proof, someone will invent a better idiot.

                    Comment


                    • #11
                      Matthew,

                      The problem with the RTC-flag is that it will be reset as soon as the system date (time) has been changed, no matter whether DOS' date command or (Power) Basic's DATE$ was used.

                      I've been working on an alternative date and time routine, saving this flag status, but you can't be sure that this will be the one and only routine for the unknown user of your software. So it will not work 100% guaranteed.

                      My guess? Microsoft coders never finished this properly, simply because Windows was coming up already.

                      ------------------

                      Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
                      http://zijlema.basicguru.eu
                      *** Opinions expressed here are not necessarily untrue ***

                      Comment


                      • #12
                        Egbert, thanks for the last routine, it works fine, this has
                        been a real treat for me, wish I could help with the question
                        on resetting the time.
                        Must be a system flag set somewhere, Unix time string does include
                        the time zone, which does indicate the change from say, EST to daylight
                        savings time, however I don't recall the exact acronym.

                        Again thanks, - Rick

                        ------------------

                        Comment


                        • #13
                          Indeed boys,
                          The European Union (15 countries including The Netherlands) switched to DST last night (Sunday March 26). Which means that time difference with Carmel (CA), where PowerBASIC is located, is 10 hours. During 1 whole week, because Sunday April 2 most states (maybe all?) in the USA will advance their clocks by one hour as well and we return to the normal difference of 9 hours.

                          See: my source code, valid for both regions, in the source code forum of this BBS.

                          ------------------


                          [This message has been edited by Egbert Zijlema (edited March 26, 2000).]

                          Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
                          http://zijlema.basicguru.eu
                          *** Opinions expressed here are not necessarily untrue ***

                          Comment


                          • #14
                            Richard, I tried to e-mail the information to the address you supplied (above) but my message bounced.
                            If you try to make something idiot-proof, someone will invent a better idiot.

                            Comment


                            • #15
                              Matthew,
                              What I can I say...
                              Theres no l in [email protected]
                              Thanks - Rick

                              ------------------

                              Comment

                              Working...
                              X