The source code of the countdown problem in php is as follows:
$ 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.
Reply to discussion (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 ');
Thank you very much.
Another problem is that it is clearly divided by 3600. it is reasonable to say that the 19-hour display can be as many as 2899.
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?
I said the display is 2899. how can it be converted to 120 days?
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