It appears there are many ways to approach date and time massaging in php. I usually am only every dealing with local time. Today, I need to work in UTC.
I am querying against an API, the data they give me about an arbitrary record is: created: Thu, 18 Jun 2009 21:44:49 +0000 * Documented as 'UTC record creation time'
utc_offset: -28800 * Difference between users re
I need to convert that to a simple string to show the user what time and date the data was submitted in their local time.
I believe, the above translates to, if in Calif. for example: Thursday 18th of June 2009 02:44:49 PM
My goal is to get to a time value I can pass to date() for easy formatting in a "pretty" format.
Is it really as simple as converting the above created time to seconds from epoch, adding in the offset, and then passing that to date()? Any gothcha's to look out for?
$created_time = 'Thu, 18 Jun 2009 21:44:49 +0000';
$utc_offset = -28800;
$seconds = strtotime($created_time);
$localized_time = $seconds + $utc_offset;
echo date(DATE_RFC822, $localized_time);
Thanks