detecting user's timezone

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

    detecting user's timezone

    Hi,

    I wonder if it's possible to detect a user (the browser's) timezone
    when he/she access my php file? I saw ppl suggesting using javascript
    to collect that information. But I wonder if it's possible to do it
    without the headache of javascript.


    Thanks,


    <?php
    // (1) here I somehow get his/her timezone


    // (2) here fill his/her login timestamp into database----
    apparently, this timestamp should be converted to a unified time
    zone.
    ?>

  • Jerry Stuckle

    #2
    Re: detecting user's timezone

    newbie wrote:
    Hi,
    >
    I wonder if it's possible to detect a user (the browser's) timezone
    when he/she access my php file? I saw ppl suggesting using javascript
    to collect that information. But I wonder if it's possible to do it
    without the headache of javascript.
    >
    >
    Thanks,
    >
    >
    <?php
    // (1) here I somehow get his/her timezone
    >
    >
    // (2) here fill his/her login timestamp into database----
    apparently, this timestamp should be converted to a unified time
    zone.
    ?>
    >
    Nope. You need something which will run on the client's system to check
    the timezone setting - i.e. javascript.

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

    Comment

    • ZeldorBlat

      #3
      Re: detecting user's timezone

      On Jul 6, 7:25 pm, newbie <mitbb...@yahoo .comwrote:
      Hi,
      >
      I wonder if it's possible to detect a user (the browser's) timezone
      when he/she access my php file? I saw ppl suggesting using javascript
      to collect that information. But I wonder if it's possible to do it
      without the headache of javascript.
      >
      Thanks,
      >
      <?php
      // (1) here I somehow get his/her timezone
      >
      // (2) here fill his/her login timestamp into database----
      apparently, this timestamp should be converted to a unified time
      zone.
      ?>
      If you're converting the time to a "unified time zone" why do you care
      what timezone they're in? Why would you be recording the time from
      the client in your database?

      Comment

      • Rami Elomaa

        #4
        Re: detecting user's timezone

        ZeldorBlat kirjoitti:
        If you're converting the time to a "unified time zone" why do you care
        what timezone they're in? Why would you be recording the time from
        the client in your database?
        Not record, just show. Naturally it makes sense to record a global time
        timestamp, like GMT, but people still like to see a time displayed in
        their local timezone, so the OP wants to know how to get it and then
        convert GMT to local time, just for _displaying_ it to user. It's common
        localization practise. Wikipedia for one does this.

        --
        Rami.Elomaa@gma il.com

        "Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
        usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze

        Comment

        • Jerry Stuckle

          #5
          Re: detecting user's timezone

          Rami Elomaa wrote:
          ZeldorBlat kirjoitti:
          If you're converting the time to a "unified time zone" why do you care
          >what timezone they're in? Why would you be recording the time from
          >the client in your database?
          >
          Not record, just show. Naturally it makes sense to record a global time
          timestamp, like GMT, but people still like to see a time displayed in
          their local timezone, so the OP wants to know how to get it and then
          convert GMT to local time, just for _displaying_ it to user. It's common
          localization practise. Wikipedia for one does this.
          >
          I've got two analog clocks on the walls, a watch on my wrist, and a
          digital clock on my toolbar. What makes you think I need your site to
          tell me what time it is?

          As for Wikipedia - I don't see any clock on the pages when I view them.

          You can include a clock if you want - but it looks stupid.

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

          Comment

          • amygdala

            #6
            Re: detecting user's timezone


            "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
            news:MKSdnQ5ea6 B8pg3bnZ2dnUVZ_ tijnZ2d@comcast .com...
            Rami Elomaa wrote:
            >ZeldorBlat kirjoitti:
            > If you're converting the time to a "unified time zone" why do you care
            >>what timezone they're in? Why would you be recording the time from
            >>the client in your database?
            >>
            >Not record, just show. Naturally it makes sense to record a global time
            >timestamp, like GMT, but people still like to see a time displayed in
            >their local timezone, so the OP wants to know how to get it and then
            >convert GMT to local time, just for _displaying_ it to user. It's common
            >localization practise. Wikipedia for one does this.
            >>
            >
            I've got two analog clocks on the walls, a watch on my wrist, and a
            digital clock on my toolbar. What makes you think I need your site to
            tell me what time it is?
            >
            As for Wikipedia - I don't see any clock on the pages when I view them.
            >
            You can include a clock if you want - but it looks stupid.
            >
            Perhaps the OP wants to show the user at what (local) time they last visited
            / contributed something / downloaded something, etc.


            Comment

            • Jerry Stuckle

              #7
              Re: detecting user's timezone

              amygdala wrote:
              "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
              news:MKSdnQ5ea6 B8pg3bnZ2dnUVZ_ tijnZ2d@comcast .com...
              >Rami Elomaa wrote:
              >>ZeldorBlat kirjoitti:
              >> If you're converting the time to a "unified time zone" why do you care
              >>>what timezone they're in? Why would you be recording the time from
              >>>the client in your database?
              >>Not record, just show. Naturally it makes sense to record a global time
              >>timestamp, like GMT, but people still like to see a time displayed in
              >>their local timezone, so the OP wants to know how to get it and then
              >>convert GMT to local time, just for _displaying_ it to user. It's common
              >>localizatio n practise. Wikipedia for one does this.
              >>>
              >I've got two analog clocks on the walls, a watch on my wrist, and a
              >digital clock on my toolbar. What makes you think I need your site to
              >tell me what time it is?
              >>
              >As for Wikipedia - I don't see any clock on the pages when I view them.
              >>
              >You can include a clock if you want - but it looks stupid.
              >>
              >
              Perhaps the OP wants to show the user at what (local) time they last visited
              / contributed something / downloaded something, etc.
              >
              >
              Why? Do you think users really *care*?

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

              Comment

              • amygdala

                #8
                Re: detecting user's timezone


                "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                news:B-2dneFEprcq3w3bn Z2dnUVZ_tTinZ2d @comcast.com...
                amygdala wrote:
                >"Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                >news:MKSdnQ5ea 6B8pg3bnZ2dnUVZ _tijnZ2d@comcas t.com...
                >>Rami Elomaa wrote:
                >>>ZeldorBlat kirjoitti:
                >>> If you're converting the time to a "unified time zone" why do you
                >>>care
                >>>>what timezone they're in? Why would you be recording the time from
                >>>>the client in your database?
                >>>Not record, just show. Naturally it makes sense to record a global time
                >>>timestamp, like GMT, but people still like to see a time displayed in
                >>>their local timezone, so the OP wants to know how to get it and then
                >>>convert GMT to local time, just for _displaying_ it to user. It's
                >>>common localization practise. Wikipedia for one does this.
                >>>>
                >>I've got two analog clocks on the walls, a watch on my wrist, and a
                >>digital clock on my toolbar. What makes you think I need your site to
                >>tell me what time it is?
                >>>
                >>As for Wikipedia - I don't see any clock on the pages when I view them.
                >>>
                >>You can include a clock if you want - but it looks stupid.
                >>>
                >>
                >Perhaps the OP wants to show the user at what (local) time they last
                >visited / contributed something / downloaded something, etc.
                >
                Why? Do you think users really *care*?
                >
                I didn't say *I* would use it. I was only trying to guess what the OP was
                after. Also, I was gonna add that I couldn't find any real valuable use for
                it, but perhaps there is. Come to think of it, and perhaps a bit far
                fetched:

                What if I had a bank account at some international bank and I wanted to see
                at what local time I made my last payment transaction to some firm?

                Just a thought.


                Comment

                • amygdala

                  #9
                  Re: detecting user's timezone


                  "amygdala" <noreply@norepl y.comschreef in bericht
                  news:46904673$0 $25474$9a622dc7 @news.kpnplanet .nl...
                  >
                  "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                  news:B-2dneFEprcq3w3bn Z2dnUVZ_tTinZ2d @comcast.com...
                  >amygdala wrote:
                  >>"Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                  >>news:MKSdnQ5e a6B8pg3bnZ2dnUV Z_tijnZ2d@comca st.com...
                  >>>Rami Elomaa wrote:
                  >>>>ZeldorBla t kirjoitti:
                  >>>> If you're converting the time to a "unified time zone" why do you
                  >>>>care
                  >>>>>what timezone they're in? Why would you be recording the time from
                  >>>>>the client in your database?
                  >>>>Not record, just show. Naturally it makes sense to record a global
                  >>>>time timestamp, like GMT, but people still like to see a time
                  >>>>displayed in their local timezone, so the OP wants to know how to get
                  >>>>it and then convert GMT to local time, just for _displaying_ it to
                  >>>>user. It's common localization practise. Wikipedia for one does this.
                  >>>>>
                  >>>I've got two analog clocks on the walls, a watch on my wrist, and a
                  >>>digital clock on my toolbar. What makes you think I need your site to
                  >>>tell me what time it is?
                  >>>>
                  >>>As for Wikipedia - I don't see any clock on the pages when I view them.
                  >>>>
                  >>>You can include a clock if you want - but it looks stupid.
                  >>>>
                  >>>
                  >>Perhaps the OP wants to show the user at what (local) time they last
                  >>visited / contributed something / downloaded something, etc.
                  >>
                  >Why? Do you think users really *care*?
                  >>
                  >
                  I didn't say *I* would use it. I was only trying to guess what the OP was
                  after. Also, I was gonna add that I couldn't find any real valuable use
                  for it, but perhaps there is. Come to think of it, and perhaps a bit far
                  fetched:
                  >
                  What if I had a bank account at some international bank and I wanted to
                  see at what local time I made my last payment transaction to some firm?
                  >
                  Just a thought.
                  But then again, if I was responsible for such an application, and I wanted
                  to provide that kind of 'convenient' service, I would probably make a user
                  of this system choose their place of residence.


                  Comment

                  • Jerry Stuckle

                    #10
                    Re: detecting user's timezone

                    amygdala wrote:
                    "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                    news:B-2dneFEprcq3w3bn Z2dnUVZ_tTinZ2d @comcast.com...
                    >amygdala wrote:
                    >>"Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                    >>news:MKSdnQ5e a6B8pg3bnZ2dnUV Z_tijnZ2d@comca st.com...
                    >>>Rami Elomaa wrote:
                    >>>>ZeldorBla t kirjoitti:
                    >>>> If you're converting the time to a "unified time zone" why do you
                    >>>>care
                    >>>>>what timezone they're in? Why would you be recording the time from
                    >>>>>the client in your database?
                    >>>>Not record, just show. Naturally it makes sense to record a global time
                    >>>>timestamp , like GMT, but people still like to see a time displayed in
                    >>>>their local timezone, so the OP wants to know how to get it and then
                    >>>>convert GMT to local time, just for _displaying_ it to user. It's
                    >>>>common localization practise. Wikipedia for one does this.
                    >>>>>
                    >>>I've got two analog clocks on the walls, a watch on my wrist, and a
                    >>>digital clock on my toolbar. What makes you think I need your site to
                    >>>tell me what time it is?
                    >>>>
                    >>>As for Wikipedia - I don't see any clock on the pages when I view them.
                    >>>>
                    >>>You can include a clock if you want - but it looks stupid.
                    >>>>
                    >>Perhaps the OP wants to show the user at what (local) time they last
                    >>visited / contributed something / downloaded something, etc.
                    >Why? Do you think users really *care*?
                    >>
                    >
                    I didn't say *I* would use it. I was only trying to guess what the OP was
                    after. Also, I was gonna add that I couldn't find any real valuable use for
                    it, but perhaps there is. Come to think of it, and perhaps a bit far
                    fetched:
                    >
                    What if I had a bank account at some international bank and I wanted to see
                    at what local time I made my last payment transaction to some firm?
                    >
                    Just a thought.
                    >
                    >
                    And what if the moon fell and landed on the Eiffel Tower? Would it
                    balance there? You can come up with all kind of "what-if's".

                    But in your case my bank has my zip code - and knows from that what my
                    timezone is. It gives me that information in that timezone.

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

                    Comment

                    • Rami Elomaa

                      #11
                      Re: detecting user's timezone

                      Jerry Stuckle kirjoitti:
                      Rami Elomaa wrote:
                      >ZeldorBlat kirjoitti:
                      > If you're converting the time to a "unified time zone" why do you care
                      >>what timezone they're in? Why would you be recording the time from
                      >>the client in your database?
                      >>
                      >Not record, just show. Naturally it makes sense to record a global
                      >time timestamp, like GMT, but people still like to see a time
                      >displayed in their local timezone, so the OP wants to know how to get
                      >it and then convert GMT to local time, just for _displaying_ it to
                      >user. It's common localization practise. Wikipedia for one does this.
                      >>
                      >
                      I've got two analog clocks on the walls, a watch on my wrist, and a
                      digital clock on my toolbar. What makes you think I need your site to
                      tell me what time it is?
                      >
                      As for Wikipedia - I don't see any clock on the pages when I view them.
                      >
                      You can include a clock if you want - but it looks stupid.
                      >
                      Oh good grief... Not a clock, TIME! Like for example: an auction that
                      ends on 12:00 am GMT time. I want to see it converted into my local,
                      Finland timezone, which would be 10:00am.

                      --
                      Rami.Elomaa@gma il.com

                      "Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
                      usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze

                      Comment

                      • Jerry Stuckle

                        #12
                        Re: detecting user's timezone

                        Rami Elomaa wrote:
                        Jerry Stuckle kirjoitti:
                        >Rami Elomaa wrote:
                        >>ZeldorBlat kirjoitti:
                        >> If you're converting the time to a "unified time zone" why do you
                        >>care
                        >>>what timezone they're in? Why would you be recording the time from
                        >>>the client in your database?
                        >>>
                        >>Not record, just show. Naturally it makes sense to record a global
                        >>time timestamp, like GMT, but people still like to see a time
                        >>displayed in their local timezone, so the OP wants to know how to get
                        >>it and then convert GMT to local time, just for _displaying_ it to
                        >>user. It's common localization practise. Wikipedia for one does this.
                        >>>
                        >>
                        >I've got two analog clocks on the walls, a watch on my wrist, and a
                        >digital clock on my toolbar. What makes you think I need your site to
                        >tell me what time it is?
                        >>
                        >As for Wikipedia - I don't see any clock on the pages when I view them.
                        >>
                        >You can include a clock if you want - but it looks stupid.
                        >>
                        >
                        Oh good grief... Not a clock, TIME! Like for example: an auction that
                        ends on 12:00 am GMT time. I want to see it converted into my local,
                        Finland timezone, which would be 10:00am.
                        >
                        That's not what we're talking about here, Rami.

                        And I want to see how many hours and minutes before it ends.

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

                        Comment

                        • Kevin Wells

                          #13
                          Re: detecting user's timezone

                          In message <1183764307.320 942.152330@z28g 2000prd.googleg roups.com>
                          newbie <mitbbsmj@yahoo .comwrote:
                          >Hi,
                          >
                          >I wonder if it's possible to detect a user (the browser's) timezone
                          >when he/she access my php file? I saw ppl suggesting using javascript
                          >to collect that information. But I wonder if it's possible to do it
                          >without the headache of javascript.
                          >
                          Would it not be possible to do this from their IP address?

                          --
                          Kev Wells http://kevsoft.topcities.com

                          ICQ 238580561
                          Useless Fact 04 The number of islands around mainland Britain is 6289.

                          Comment

                          • Lars Eighner

                            #14
                            Re: detecting user's timezone

                            In our last episode,
                            <16ed3bff4e.Kev in@talktalk.net >,
                            the lovely and talented Kevin Wells
                            broadcast on comp.lang.php:
                            In message <1183764307.320 942.152330@z28g 2000prd.googleg roups.com>
                            newbie <mitbbsmj@yahoo .comwrote:
                            >>Hi,
                            >>
                            >>I wonder if it's possible to detect a user (the browser's) timezone
                            >>when he/she access my php file? I saw ppl suggesting using javascript
                            >>to collect that information. But I wonder if it's possible to do it
                            >>without the headache of javascript.
                            >>
                            Would it not be possible to do this from their IP address?
                            You could probably beat outright guessing in that way, but there is no
                            reliable relationship between IP and geography, no necessary relationship
                            between the IP making the request and the user's actual IP at any given
                            moment, and again no necessary relationship between the user's actual IP at
                            any moment and geography.

                            You might get it right most of the time, but you will get it wrong a
                            significant part of the time, and in some cases you'll get it wrong in an
                            absurd way --- such as claiming the page was last updated some time in the
                            future.

                            --
                            Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
                            Countdown: 561 days to go.
                            Friends of Lizbeth: help replace failed a/c at Austin's no-kill shelter
                            <https://secure.groundsp ring.org/dn/index.php?aid=1 2349>

                            Comment

                            • houghi

                              #15
                              Re: detecting user's timezone

                              Lars Eighner wrote:
                              >Would it not be possible to do this from their IP address?
                              >
                              You could probably beat outright guessing in that way, but there is no
                              reliable relationship between IP and geography, no necessary relationship
                              between the IP making the request and the user's actual IP at any given
                              moment, and again no necessary relationship between the user's actual IP at
                              any moment and geography.
                              Guessing is a bit wrong. I would say guestimating.
                              You might get it right most of the time, but you will get it wrong a
                              significant part of the time, and in some cases you'll get it wrong in an
                              absurd way --- such as claiming the page was last updated some time in the
                              future.
                              Most of the times would be good enough for most of the sites. You can do
                              a first guestimate and then have a cookie so that people can change it
                              and have the correct time whenever they come back.

                              The accuracy would also depend on what you intend to do with it.

                              houghi
                              --
                              _______________ _________ Open your eyes, open your mind
                              | proud like a god don't pretend to be blind
                              | trapped in yourself, break out instead
                              http://openSUSE.org | beat the machine that works in your head

                              Comment

                              Working...