rgb192
asked on
convert timestamp to date time in new york
convert timestamp to date time in new york
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/f unction.da te.php
Additioinally the newer versions of PHP allow you to specify time zone.
http://php.net/manual/en/f
Additioinally the newer versions of PHP allow you to specify time zone.
ASKER
Unix timestamp 432403200
Found this interesting page on converting epoch time:
http://www.epochconverter. com/
http://www.epochconverter.
date(output format, epoch); Output format example: 'r' = RFC 2822 date
Knowing the original time zone would help but the following code:
yields: Wednesday, September 14, 1983, 12:00 pm
<?php
$test = date("l, F j, Y, g:i a",432403200 );
print $test;
?>
yields: Wednesday, September 14, 1983, 12:00 pm
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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
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(
http://php.net/manual/en/function.date-default-timezone-set.php
See also:
http://php.net/manual/en/timezones.php
ASKER
combine these two answers.
thanks
thanks