kreut — 2013-07-04T09:31:59-04:00 — #1
I'm not sure that this question is appropriate for the forum, so apologies in advance, but I was wondering if there's a publicly available database that can convert php's timezones to those that we use in everyday speech. For example, php's timezone of "America/Los Angeles" would match up to PST. (Pacific Standard Time).
qmonkey — 2013-07-04T10:39:54-04:00 — #2
I would think there is somewhere but I don't know of it. Here's one way to get it done.
$tz = date_default_timezone_get();
date_default_timezone_set( 'America/Los_Angeles' );
$shorthand = date( 'T' );
date_default_timezone_set( $tz );
kreut — 2013-07-04T13:43:11-04:00 — #3
Even better! Thank you for your response.
salathe — 2013-07-04T17:30:03-04:00 — #4
And here are two more, doing the same thing in different styles, that don't affect the script-wide timezone setting:
echo date_format(date_create('now', timezone_open('America/Los_Angeles')), 'T');
$now = new DateTime('now', new DateTimeZone('America/Los_Angeles'));
kreut — 2013-07-04T17:48:16-04:00 — #5
Even cooler! Thanks to you both.