Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

convert timestamp to date time in new york

convert timestamp to date time in new york
Avatar of shdwmage
shdwmage
Flag of United States of America image

I'd love to help, but can you put a bit more detail in it.  Like where are we getting the date stamp from, what format.  What time zone is the server in. Something, anything.
A lot of information about the PHP Date function is available here:
http://php.net/manual/en/function.date.php

Additioinally the newer versions of PHP allow you to specify time zone.
Avatar of rgb192

ASKER

Unix timestamp 432403200
Found this interesting page on converting epoch time:
http://www.epochconverter.com/

date(output format, epoch); Output format example: 'r' = RFC 2822 date
Knowing the original time zone would help but the following code:
<?php
$test = date("l, F j, Y, g:i a",432403200 ); 
print $test;
?>

Open in new window


yields: Wednesday, September 14, 1983, 12:00 pm
ASKER CERTIFIED SOLUTION
Avatar of shdwmage
shdwmage
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ray, wouldn't that depend on what his problem actually is?

I read it as converting an already existing date/time stamp to new york time, not the current date time.
A datetime value is a string of data, and it is always localized, whether or not localization is shown in the string.  A timestamp is an integer.

In the date() function the second argument, if omitted, is the integer value of time(), which is the same everywhere in the world, even though there are different timezones and there is that International Date Line.  It screws up your medications when you cross it ;-)
http://php.net/manual/en/function.date.php

The date_default_timezone_set() function tells PHP what the localization is for the date() function and some other things, like the strtotime() function.
http://php.net/manual/en/function.date-default-timezone-set.php

See also:
http://php.net/manual/en/timezones.php
Avatar of rgb192

ASKER

combine these two answers.
thanks