Php time acquisition is 8 hours different, and php time retrieval is 8 hours different

Source: Internet
Author: User

Php time acquisition is 8 hours different, and php time retrieval is 8 hours different
Php time difference: 8 hours by Wu xueying
Date_default_timezone_set ('prc ');
$ TimeStr = date ("Y-m-d H: I: s", time ());

Adding this sentence on the server can solve the problem of AFNetWorking parsing json.

Error Domain = NSCocoaErrorDomain Code = 3840 "The operation couldn't be completed. (Cocoa error 3840 .) "(JSON text did not start with array or object and option to allow fragments not set .) userInfo = 0x196463f0 {NSDebugDescription = JSON text did not start with array or object and option to allow fragments not set .}




PHP is 8 hours different

Add date_default_timezone_set ('prc') directly on the php page; // This sentence is used to eliminate the time difference

PHP uses the COOKIE acquisition time, which is eight hours different from the system time. The Code is as follows:

Date_default_timezone_set ("prc ");

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.