Convert timestamp with timezone to readable date
With timestamp, do you mean Unix epoch time?
When working with times and dates, I always find something useful at http://www.epochconverter.com .
For PHP see Programming> Epoch in PHP
Using the function date
.
$epoch = 1340000000;
echo date('r', $epoch); // output as RFC 2822 date - returns local time
echo gmdate('r', $epoch); // returns GMT/UTC time
Using the class DateTime
$epoch = 1344988800;
$dt = new DateTime("@$epoch"); // convert UNIX timestamp to PHP DateTime
echo $dt->format('Y-m-d H:i:s'); // output = 2012-08-15 00:00:00
Time zone setting
If you are using PHP 5.1 or higher use date_default_timezone_set to set / unset your timezone. PHP timezone handling takes care of daylight saving time ( PHP timezone list ).
The value you give - 1434434419100-0400
is definitely not a standard formatted timestamp. See w3.org and wikipedia for an overview of what is considered standard. The closest I could find is that it is an epoch 1434434419
(i.e. Tue, June 16, 2015 06:00:19 GMT) plus 100-0400
. Don't know what it means 100
, but -0400
may indicate UTC-04: 00 .
source to share