Click here to get back home

DATE formatting and TIME zones - how to deal with this hell?

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
DATE formatting and TIME zones - how to deal with this hell? WebCM 06-21-2008
Get Chitika Premium
Posted by WebCM on June 25, 2008, 11:49 am
Please log in for more thread options
Can you DIFFERENTIATE gmtime() and gmdate()? I've written clearly -
there is no >> gmtime() << function. I'd like to get current UNIX
TIMESTAMP. Perhaps, it's possible by gmdate('U').

How about timezones? Should I store times in GMT in database or better
in local timezone for selected language (e.g. EN, DE, PL, EN/US)? My
CMS is multilingual. How should I achieve it?
date_default_timezone_set('GMT')? setlocale('en_US')?

Posted by AnrDaemon on June 25, 2008, 7:43 pm
Please log in for more thread options
Greetings, WebCM.
In reply to Your message dated Wednesday, June 25, 2008, 19:49:06,

> Can you DIFFERENTIATE gmtime() and gmdate()? I've written clearly -
there is no >>> gmtime() << function. I'd like to get current UNIX
> TIMESTAMP. Perhaps, it's possible by gmdate('U').

Obviously,

gmdate('U') === date('U') === (string)time()

UNIXTIME has nothing to do with timezones.
It is what it is - amount of seconds passed from ....
RTFM.

> How about timezones? Should I store times in GMT in database or better
> in local timezone for selected language (e.g. EN, DE, PL, EN/US)? My
> CMS is multilingual. How should I achieve it?
> date_default_timezone_set('GMT')? setlocale('en_US')?

It's up to you. But I prefer to store dates as dates. Obviously, in my own
timezone, because database stored on my server.
That way, I will never run in time conflict, where reply beeing posted before
question.
How to deal with dates at display time - read my first answer in this thread.


--


Similar ThreadsPosted
2 different time zones September 29, 2004, 9:54 pm
Displaying time in different time zones May 11, 2005, 11:52 am
OT: Looking for data (.csv?) that associates zip codes with time zones July 2, 2005, 6:36 am
Date formatting February 16, 2005, 5:33 pm
Php Date-Formatting Help January 5, 2006, 6:18 pm
formatting time April 28, 2006, 2:49 am
PHP time formatting ? May 15, 2008, 11:16 am
Formatting a date with php from a mysql table October 27, 2007, 3:57 pm
Formatting date returned from MySQL query February 22, 2006, 8:57 am
formatting time string from: 2007-05-30 11:46:34 June 6, 2007, 11:10 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap