Troubles with converting PHP timestamp to local date string -


i'm trying convert linux server timestamp formatted local date string.

the $timestamp 1429800741, , expected date string "2015/4/23 14:52:21", use date("y/n/j h:i:s", $timestamp), result "2015/4/23 06:52:21", it's 8 hours slower.

i checked server command line "date -r", , shows "thu, 23 apr 2015 14:55:59 +0800".

in php, function date_default_timezone_get() echo "asia/shanghai".

it looks timezone has been set correctly, why formatted string wrong ?

anyone please me, thanks!!!

i not getting proper time on pc, believe proper approach question, maybe work out further:

$datetime = new datetime(); $datetime->settimestamp('1429800741'); $datetime->settimezone(new datetimezone('asia/shanghai'));  echo $datetime->format('y/n/j h:i:s p'); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -