I have a unix timestamp that is set to +5, but I'd like to convert it to -5, EST Standard time. I would just make the time stamp be generated in that time zone, but I'm grabbing it from another source which is putting it at +5.
Current Unmodified Timestamp Being Converted Into A Date
<? echo gmdate("F j, Y, g:i a", 1369490592) ?>
Notice that UNIX Epoch is UTC so it identifies without errors a specific moment in time. Never ask about the timezone of a UNIX epoch timestamp, it is UTC by definition.
To easily convert UNIX timestamp to date in the . csv file, do the following: 1. =R2/86400000+DATE(1970,1,1), press Enter key.
Unix timestamps are always based on UTC (otherwise known as GMT). It is illogical to think of a Unix timestamp as being in any particular time zone. Unix timestamps do not account for leap seconds.
You cannot “ get a TimeZone ID from a certain TimeStamp”, that is impossible. Your count-from-epoch was made while accounting for a certain time zone, usually UTC. If must know that intended zone used in creating that count-from-epoch, it cannot be deduced.
Use DateTime and DateTimeZone:
$dt = new DateTime('@1369490592');
$dt->setTimeZone(new DateTimeZone('America/Chicago'));
echo $dt->format('F j, Y, g:i a');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With