PHP Warning: strtotime () Error Solution

Source: Internet
Author: User
Tags echo date

The strtotime () function is a php date function. This problem occurs when the date. timezone in php. ini is not set. You only need to configure the time zone.


At the beginning of php5.1.0, the date. timezone option is added to php. ini, Which is disabled by default. The display time is Greenwich Mean Time, which is exactly eight hours different from that in Beijing.

Solution:

Modify the php. ini file and search for the file; date. timezone =. Remove the semicolon before and add the time zone after "=.

For example:

Asia/Chongqing (Chongqing ),
Asia/Shanghai (Shanghai ),
Asia/Urumqi (Urumqi ),
Asia/Macao (Macao ),
Asia/Hong_Kong (Hong Kong ),
Asia/Taipei (Taipei ),
PRC China

For example

The Code is as follows: Copy code

Date. timezone = PRC

You can also add at the top of the php program page

The Code is as follows: Copy code

<? Php
Date_default_timezone_set ('Asia/chongqing ');
Echo date ('Y-m-d H: I: s ');
?>

Related Recommendations

Multiple Solutions for 8 hours of time difference in php

Http://www.bKjia. c0m/phper/31/42398 .htm

Php date difference 8 small time Solution

Http://www.bKjia. c0m/phper/31/37224 .htm

Php obtains server time (solving the eight-hour gap)

Http://www.bKjia. c0m/phper/31/34041 .htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.