how to determine client's local time ?

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

    how to determine client's local time ?

    I'm just lost here.. Is there a function to determine current time on
    the client's computer clock ?

    Links / Pointers?

    Mike

  • Gordon Burditt

    #2
    Re: how to determine client's local time ?

    >I'm just lost here.. Is there a function to determine current time on[color=blue]
    >the client's computer clock ?
    >
    >Links / Pointers?[/color]

    PHP runs on the server, not on the client.

    Javascript is Turned Off (tm).

    Gordon L. Burditt

    Comment

    • siliconmike

      #3
      Re: how to determine client's local time ?



      Gordon Burditt wrote:[color=blue][color=green]
      > >I'm just lost here.. Is there a function to determine current time on
      > >the client's computer clock ?
      > >
      > >Links / Pointers?[/color]
      >
      > PHP runs on the server, not on the client.
      >[/color]

      Well something to extract from http headers / or something from tcp
      packets (ouch!!!) ???

      Mike

      Comment

      • Gordon Burditt

        #4
        Re: how to determine client's local time ?

        >> >I'm just lost here.. Is there a function to determine current time on[color=blue][color=green][color=darkred]
        >> >the client's computer clock ?
        >> >
        >> >Links / Pointers?[/color]
        >>
        >> PHP runs on the server, not on the client.
        >>[/color]
        >
        >Well something to extract from http headers / or something from tcp
        >packets (ouch!!!) ???[/color]

        You can't extract information that isn't there. HTTP headers sent
        from the client to the server might include timestamps in
        "if-modified-since" headers but they aren't CURRENT timestamps and
        could easily be months old.

        Javascript is still Turned Off(tm).

        Why do you need this information?

        Gordon L. Burditt

        Comment

        • Chung Leong

          #5
          Re: how to determine client's local time ?

          IIRC, the timestamp in TCP packets is a tick count from when the
          computer was booted up and not the actual time.

          Comment

          • siliconmike

            #6
            Re: how to determine client's local time ?

            OH PLEASE TURN JAVASCRIPT ON !!

            In fact, I need to know what date it is on client side to serve them
            content which is date specific..

            Mike

            Gordon Burditt wrote:[color=blue][color=green][color=darkred]
            > >> >I'm just lost here.. Is there a function to determine current time on
            > >> >the client's computer clock ?
            > >> >
            > >> >Links / Pointers?
            > >>
            > >> PHP runs on the server, not on the client.
            > >>[/color]
            > >
            > >Well something to extract from http headers / or something from tcp
            > >packets (ouch!!!) ???[/color]
            >
            > You can't extract information that isn't there. HTTP headers sent
            > from the client to the server might include timestamps in
            > "if-modified-since" headers but they aren't CURRENT timestamps and
            > could easily be months old.
            >
            > Javascript is still Turned Off(tm).
            >
            > Why do you need this information?
            >
            > Gordon L. Burditt[/color]

            Comment

            • Alvaro G Vicario

              #7
              Re: how to determine client's local time ?

              *** siliconmike wrote/escribió (6 Jul 2005 22:09:22 -0700):[color=blue]
              > In fact, I need to know what date it is on client side to serve them
              > content which is date specific..[/color]

              So visitors from Asia and Europe can access the contents a few hours before
              those from America?


              --
              -- Álvaro G. Vicario - Burgos, Spain
              -- http://bits.demogracia.com - Mi sitio sobre programación web
              -- Don't e-mail me your questions, post them to the group
              --

              Comment

              • Niklas Schönberg

                #8
                Re: how to determine client's local time ?

                -----BEGIN PGP SIGNED MESSAGE-----
                Hash: SHA1

                siliconmike wrote:[color=blue]
                > OH PLEASE TURN JAVASCRIPT ON !![/color]

                Why not try comp.lang.javas cript? I think you will get better answers there.
                -----BEGIN PGP SIGNATURE-----
                Version: GnuPG v1.4.1 (GNU/Linux)
                Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

                iD8DBQFCzQytZeV xmdI1of8RAq6TAJ 47sjy8iP/fopSH9UhVVHlnLD NsXQCg4A33
                rknARP7jsCRxkm4 XPiVdM90=
                =ERqH
                -----END PGP SIGNATURE-----

                Comment

                • Gordon Burditt

                  #9
                  Re: how to determine client's local time ?

                  >OH PLEASE TURN JAVASCRIPT ON !!

                  As long as it can be used to write spyware, it stays off.
                  As long as it can be used to open two windows when you close one,
                  it stays off.
                  [color=blue]
                  >In fact, I need to know what date it is on client side to serve them
                  >content which is date specific..[/color]

                  Are you assuming that the client machine has the clock set anywhere
                  near correctly? As in within 1 year of the correct date? I don't
                  think that's a very safe assumption.

                  Gordon L. Burditt

                  Comment

                  • pdt256

                    #10
                    Re: how to determine client's local time ?

                    I'm pretty sure you can determine what timezone the person is in based
                    on their IP address.

                    javascript can stay off.

                    Comment

                    • Gordon Burditt

                      #11
                      Re: how to determine client's local time ?

                      >I'm pretty sure you can determine what timezone the person is in based[color=blue]
                      >on their IP address.[/color]

                      Given the existence of dialup lines and international telephone
                      calls, that's going to be difficult to do 100%. Given the existence
                      of things like AOL (and other ISPs) web proxies, it's even harder
                      to do this 100%. You might manage to do "close enough", although
                      it wouldn't surprise me if quite a few people near a timezone
                      boundary who use dialup lines dial across the boundary.

                      Then there's the mobile wireless users.

                      Assuming that this is something the user DOESN'T WANT to spoof,
                      you could try asking the user what his time zone is, using your
                      best guess at the time zone as the default.
                      [color=blue]
                      >javascript can stay off.[/color]

                      Gordon L. Burditt

                      Comment

                      • Chung Leong

                        #12
                        Re: how to determine client's local time ?

                        It's important to bear in mind that there is no absolute time. If a
                        visitor had been moving at close to the speed of light, then the
                        difference between the client time and server time could be days,
                        perhaps even years.

                        One should not neglect either those who are still partying like it's
                        1999.

                        Comment

                        • Wayne

                          #13
                          Re: how to determine client's local time ?

                          On 6 Jul 2005 14:30:34 -0700, "siliconmik e" <siliconmike@ya hoo.com>
                          wrote:
                          [color=blue]
                          >I'm just lost here.. Is there a function to determine current time on
                          >the client's computer clock ?[/color]

                          You can use Javascript on the client to set a cookie with their
                          current timezone offset and then read that timezone offset in PHP and
                          adjust all your times appropriately.

                          I do that exact thing in a number of my sites so all the dates/times
                          are shown in the users local timezone.

                          Comment

                          Working...