Click here to get back home

DateTime timezones

 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
DateTime timezones Martin Sweeney 07-09-2008
Get Chitika Premium
Posted by Martin Sweeney on July 9, 2008, 7:26 am
Please log in for more thread options
I am writing writing some code which records when a user (user x)
performs an action. I need to be able to tell other users when 'user
x' performed said action, but relative to the end user's timezone.

My users can all be in different time zones. What is the best way to
store a timestamp for an action and then to display a human readable
time of the action in someone's time zone?

For instance, 'user x' uploads a file at 13:00 UTC. This needs to be
presented as 21:00 for 'user y' in Adelaide.

Currently, my script records the unix timestamp as a marker of when
the action was performed.

I had hoped that the code below would work, but it doesn't appear to:

$actionTime = 1215602000;
$dtz = new DateTimeZone('Australia/Adelaide');
$dt = new DateTime("@$actionTime", $dtz);
echo $dt->format('r');


Thanks!

Martin Sweeney

Similar ThreadsPosted
Convert stored mysql DateTime of UTC datetime stamp into another time zone December 2, 2008, 2:48 pm
timezones... August 29, 2004, 5:07 pm
Converting timezones in PHP 4.x September 9, 2004, 1:10 am
different timezones in different directories November 6, 2006, 9:50 am
Working with Timezones and DST May 27, 2007, 9:24 am
Working with Timezones and DST May 27, 2007, 9:24 am
Cookie timeout and timezones August 15, 2005, 7:49 pm
How to Enumerate and Calculate Timezones? June 13, 2007, 11:00 pm
timezones and time display March 9, 2008, 10:13 pm
Setting the environment variable for timezones ... April 3, 2006, 12:42 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap