Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14425

Re: Dealing with timestamps from different timezones - general approach for basic saving?

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.php
Subject Re: Dealing with timestamps from different timezones - general approach for basic saving?
Date 2014-10-29 01:50 +0000
Organization A noiseless patient Spider
Message-ID <m2ph4r$hum$1@dont-email.me> (permalink)
References <cd058cd0-6ace-447c-b4cf-482117630dc0@googlegroups.com>

Show all headers | View raw


On Tue, 28 Oct 2014 12:42:48 -0700, e.blumstengel wrote:

> What are your approaches for real-life scenarios when dealing with users
> from different timezones? Any help is much appreciated...

Apply UTC timestamps to everything, assuming the server knows what UTC is.

To display something to a visitor in a meaningful timezone for the 
visitor, you need to get the visitor's timezone, and that's not part of 
the normal http protocol.

So you can either display posts as UTC, play guess the timezone based on 
the visitors IP (which may indicate their location), use javascript to 
detect the local timezone in the browser and convert the timestamp on the 
fly, ask the user what timezone they want things displayed in, or use 
javacript to obtain their timezone in an ajax exchange.

If you know their timezone on the server (you used javascript to acquire 
it using an ajax exchange, or they told you it) then you can send them a 
cookie and use the cookie in future (until it expires), and obviously you 
can also hold it in session storage for the current session.

-- 
Denis McMahon, denismfmcmahon@gmail.com

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Dealing with timestamps from different timezones - general approach for basic saving? e.blumstengel@googlemail.com - 2014-10-28 12:42 -0700
  Re: Dealing with timestamps from different timezones - general approach for basic saving? Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-28 16:51 -0400
    Re: Dealing with timestamps from different timezones - general approach for basic saving? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-30 08:14 +0100
      Re: Dealing with timestamps from different timezones - general approach for basic saving? Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-30 10:04 -0400
        Re: Dealing with timestamps from different timezones - general approach for basic saving? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-30 22:38 +0100
          Re: Dealing with timestamps from different timezones - general approach for basic saving? Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-30 18:38 -0400
            Re: Dealing with timestamps from different timezones - general approach for basic saving? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-31 05:33 +0100
              Re: Dealing with timestamps from different timezones - general approach for basic saving? Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-31 09:51 -0400
                Re: Dealing with timestamps from different timezones - general approach for basic saving? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-01 09:31 +0100
                Re: Dealing with timestamps from different timezones - general approach for basic saving? Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-01 09:31 -0400
                drifted into ABUSE: Re: Dealing with timestamps bill <william@TechServSys.com> - 2014-11-01 11:21 -0400
                Re: drifted into ABUSE: Re: Dealing with timestamps Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-01 17:04 +0100
                Re: drifted into ABUSE: Re: Dealing with timestamps Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-01 21:32 -0400
                Re: drifted into ABUSE: Re: Dealing with timestamps Tim Streater <timstreater@greenbee.net> - 2014-11-02 09:27 +0000
  Re: Dealing with timestamps from different timezones - general approach for basic saving? Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-29 01:50 +0000

csiph-web