The source code of the countdown problem in php is as follows: $ time1strtotime (date (Y-m-d & nbsp; H: I: s); $ time2strtotime (& nbsp; 00:00:00 ); $ time3strtotime (); $ sub1ceil ($ time2-$ time1) 3600); $ sub2cei php countdown problem
The source code is like this.
$ Time1 = strtotime (date ("Y-m-d H: I: s "));
$ Time2 = strtotime ("00:00:00 ");
$ Time3 = strtotime ("2013-01-01 ");
$ Sub1 = ceil ($ time2-$ time1)/3600 );
$ Sub2 = ceil ($ time3-$ time1)/86400 );
Echo $ time2 ."
";
Echo $ time1 ."
";
Echo "distance time $ sub1 ";
?>
The output result is
Strict Standards: strtotime () [function. strtotime]: It is not safe to rely on the system's timezone settings. please use the date. timezone setting, the TZ environment variable or the date_default_timezone_set () function. in case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. we selected 'utc' for '8. 0/no DST 'Instead in D: \ AppServ \ www \ base1 \ strcmp. php on line 18
1415664000
1405231125
Distance: 2899
The Great God helped solve the problem.
------ Solution --------------------
You have not set the time zone, or the time zone code is incorrect.
Php. ini
Date. timezone = PRC; Beijing time
Or program
Date_default_timezone_set ('prc ');
------ Solution --------------------
Why?
$ Time1 = strtotime (date ("Y-m-d H: I: s"); // isn't this today? 2014-07-13
$ Time2 = strtotime ("00:00:00 ");
Is there 120 days from?
------ Solution --------------------
You can convert the time according to the time difference you calculated to implement the specific time of the countdown.
For more information, see:
http://blog.csdn.net/u011619326/article/details/37740129