Working with Timezones and DST

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

    Working with Timezones and DST

    Hello everyone.

    I am creating a JavaScript project which will allow users to see what
    time it is in other countries. I am wondering if there's any way to
    have the server work this out, without having to update a database
    constantly with the times and dates that certain countries set their
    clocks back or forward.

    Can this be done, or do I need to connect to a time server? Ideally, I
    need a time server that will return a JavaScript object containing the
    information I need, but I don't think one exists.

    Please could someone suggest the steps I need to take to quickly
    obtain the correct time for any given country, which will take DST
    into account? Sadly, to my knowledge, the UK is the only country that
    has hard-coded rules for when the clocks are changed, where as it
    seems to be a political thing for all other countries.

    If I have to run a database with this information, then so be it, but
    it seems like a lot of manual work, and I'm not sure how often I'd
    need to update it.

    Many thanks in advance.

    Daz.

  • Jerry Stuckle

    #2
    Re: Working with Timezones and DST

    Daz wrote:
    Hello everyone.
    >
    I am creating a JavaScript project which will allow users to see what
    time it is in other countries. I am wondering if there's any way to
    have the server work this out, without having to update a database
    constantly with the times and dates that certain countries set their
    clocks back or forward.
    >
    Can this be done, or do I need to connect to a time server? Ideally, I
    need a time server that will return a JavaScript object containing the
    information I need, but I don't think one exists.
    >
    Please could someone suggest the steps I need to take to quickly
    obtain the correct time for any given country, which will take DST
    into account? Sadly, to my knowledge, the UK is the only country that
    has hard-coded rules for when the clocks are changed, where as it
    seems to be a political thing for all other countries.
    >
    If I have to run a database with this information, then so be it, but
    it seems like a lot of manual work, and I'm not sure how often I'd
    need to update it.
    >
    Many thanks in advance.
    >
    Daz.
    >
    And what are you going to do with the United States, which has six time
    zones (and some not everyone observes DST). Or Russia, which has eight
    time zones?

    In the U.S., everyone who participates does so on the same day. But not
    everyone has to participate.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Daz

      #3
      Re: Working with Timezones and DST

      On May 27, 3:31 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      Daz wrote:
      Hello everyone.
      >
      I am creating a JavaScript project which will allow users to see what
      time it is in other countries. I am wondering if there's any way to
      have the server work this out, without having to update a database
      constantly with the times and dates that certain countries set their
      clocks back or forward.
      >
      Can this be done, or do I need to connect to a time server? Ideally, I
      need a time server that will return a JavaScript object containing the
      information I need, but I don't think one exists.
      >
      Please could someone suggest the steps I need to take to quickly
      obtain the correct time for any given country, which will take DST
      into account? Sadly, to my knowledge, the UK is the only country that
      has hard-coded rules for when the clocks are changed, where as it
      seems to be a political thing for all other countries.
      >
      If I have to run a database with this information, then so be it, but
      it seems like a lot of manual work, and I'm not sure how often I'd
      need to update it.
      >
      Many thanks in advance.
      >
      Daz.
      >
      And what are you going to do with the United States, which has six time
      zones (and some not everyone observes DST). Or Russia, which has eight
      time zones?
      >
      In the U.S., everyone who participates does so on the same day. But not
      everyone has to participate.
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstuck...@attgl obal.net
      =============== ===
      Absolutely nothing! Hehe. Unless of course you have a suggestion. I
      cannot do the impossible. I am quite sure that this problem can be
      overcome, however. I was under the impression that the PHP timezones
      would take care of it. Would it not?

      Comment

      • Aerik

        #4
        Re: Working with Timezones and DST

        I've seen (and am using) an alternate syntax to get the time in
        different zones - I don't really know what's going on "under the hood"
        but thought I'd mention it. What works on the server I'm using (linux
        of unknown flavor, PHP 4.3) is setting the environment to be
        "EST5EDT4" etc.

        Aerik


        Comment

        • Jerry Stuckle

          #5
          Re: Working with Timezones and DST

          Daz wrote:
          On May 27, 3:31 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          >Daz wrote:
          >>Hello everyone.
          >>I am creating a JavaScript project which will allow users to see what
          >>time it is in other countries. I am wondering if there's any way to
          >>have the server work this out, without having to update a database
          >>constantly with the times and dates that certain countries set their
          >>clocks back or forward.
          >>Can this be done, or do I need to connect to a time server? Ideally, I
          >>need a time server that will return a JavaScript object containing the
          >>information I need, but I don't think one exists.
          >>Please could someone suggest the steps I need to take to quickly
          >>obtain the correct time for any given country, which will take DST
          >>into account? Sadly, to my knowledge, the UK is the only country that
          >>has hard-coded rules for when the clocks are changed, where as it
          >>seems to be a political thing for all other countries.
          >>If I have to run a database with this information, then so be it, but
          >>it seems like a lot of manual work, and I'm not sure how often I'd
          >>need to update it.
          >>Many thanks in advance.
          >>Daz.
          >And what are you going to do with the United States, which has six time
          >zones (and some not everyone observes DST). Or Russia, which has eight
          >time zones?
          >>
          >In the U.S., everyone who participates does so on the same day. But not
          >everyone has to participate.
          >>
          >--
          >============== ====
          >Remove the "x" from my email address
          >Jerry Stuckle
          >JDS Computer Training Corp.
          >jstuck...@attg lobal.net
          >============== ====
          >
          Absolutely nothing! Hehe. Unless of course you have a suggestion. I
          cannot do the impossible. I am quite sure that this problem can be
          overcome, however. I was under the impression that the PHP timezones
          would take care of it. Would it not?
          >
          The time zone will be the time zone for your server. There is no way
          for you to tell what the timezone on my machine is.

          Your best bet is to just ask them what timezone they are in, and whether
          or not to adjust for dst.

          As for the dates of when to start/stop. I don't have any good
          recommendations there. I suspect the timezones would set it
          appropriately - but there are way too many to be usable, IMHO.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • Daz

            #6
            Re: Working with Timezones and DST

            On May 27, 8:13 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            Daz wrote:
            On May 27, 3:31 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            Daz wrote:
            >Hello everyone.
            >I am creating a JavaScript project which will allow users to see what
            >time it is in other countries. I am wondering if there's any way to
            >have the server work this out, without having to update a database
            >constantly with the times and dates that certain countries set their
            >clocks back or forward.
            >Can this be done, or do I need to connect to a time server? Ideally, I
            >need a time server that will return a JavaScript object containing the
            >information I need, but I don't think one exists.
            >Please could someone suggest the steps I need to take to quickly
            >obtain the correct time for any given country, which will take DST
            >into account? Sadly, to my knowledge, the UK is the only country that
            >has hard-coded rules for when the clocks are changed, where as it
            >seems to be a political thing for all other countries.
            >If I have to run a database with this information, then so be it, but
            >it seems like a lot of manual work, and I'm not sure how often I'd
            >need to update it.
            >Many thanks in advance.
            >Daz.
            And what are you going to do with the United States, which has six time
            zones (and some not everyone observes DST). Or Russia, which has eight
            time zones?
            >
            In the U.S., everyone who participates does so on the same day. But not
            everyone has to participate.
            >
            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstuck...@attgl obal.net
            =============== ===
            >
            Absolutely nothing! Hehe. Unless of course you have a suggestion. I
            cannot do the impossible. I am quite sure that this problem can be
            overcome, however. I was under the impression that the PHP timezones
            would take care of it. Would it not?
            >
            The time zone will be the time zone for your server. There is no way
            for you to tell what the timezone on my machine is.
            >
            Your best bet is to just ask them what timezone they are in, and whether
            or not to adjust for dst.
            Or I can use JavaScripts Date() object... It's not 100% accurate, but
            neither is asking them.
            As for the dates of when to start/stop. I don't have any good
            recommendations there. I suspect the timezones would set it
            appropriately - but there are way too many to be usable, IMHO.
            Thanks for your comments. I think I will use JavaScript to make an
            educated guess, and give them the option to change it if it's
            incorrect.


            Comment

            Working...