The date () method reads the timestamp !! Help everyone !!! If there is a timestamp: 1343836800 (1) in my local: PHPcodeechodate ('Y-m-dH: I: S', 1343836800); output: the 2012-08-0116:00:0 date () method reads the timestamp !! Help everyone !!!
If there is a timestamp: 1343836800
(1) locally:
PHP code
Echo date ('Y-m-d H: I: S', 1343836800 );
Output: 16:00:00
(2) on the company's server:
PHP code
Echo date ('Y-m-d H: I: S', 1343836800 );
Output: 00:00:00, 2012-08-02
Why are the output values of the same timestamp different ???
------ Solution --------------------
The time difference between the two is 8 hours. it must be a problem with the time zone settings.
------ Solution --------------------
Your local environment is Greenwich Mean Time. Set the time zone:
Date_default_timezone_set ('prc ');
Echo date ('Y-m-d H: I: S', 1343836800 );