Calculation method of time difference added by date-

Source: Internet
Author: User
Calculation method of date plus time difference-Urgent !!!!! Date_default_timezone_set ('etc/GMT'); $ now & nbsp; = & nbsp; mktime (date ('h'), date ('I '), date ('s'), date ('M'), date ('D'), date ('Y ')) + $ timezone * calculation method of date plus time difference -- Urgent !!!!!

date_default_timezone_set('Etc/GMT');
$now = mktime(date('H'),date('i'),date('s'),date('m'),date('d'),date('Y'))+$timezone*60*60*1000;
$site_date = date("g:i A(D)",$now);


Timezone indicates the time difference. Why am I using this? the retrieval time is incorrect ..

Please help.
------ Solution --------------------
$ T = time ();
Echo date ('Beijing time Y-m-d H: I: S', $ t ),'
';
Date_default_timezone_set ('etc/GMT ');
Echo date ('Greenwich mean time Y-m-d H: I: S', $ t ),'
';

For ($ I = 1; $ I <= 12; $ I ++ ){
Date_default_timezone_set ("Etc/GMT-$ I ");
Echo date ("East $ I zone time Y-m-d H: I: s", $ t ),'
';
}
14:14:01 Beijing time
Greenwich Mean Time 06:14:01
07:14:01
Eastern Region 2 time 08:14:01
Eastern 3 zone time 09:14:01
10:14:01, December 4, China time
11:14:01
12:14:01
13:14:01, January 9, China East 7 time
14:14:01, UTC + 8
15:14:01
16:14:01
17:14:01
18:14:01

------ Solution --------------------
Reference:
Reference: usage:
Echo Fun: now ('Y-m-d H: I: S', time (); // 00:13:40
Echo Fun: now ('Y-m-d H: I: s'); // 2012-10-30 00:13:40
Echo Fun: now (); /// 1351527292
Echo time (); // 135152729 ......

Because I put this new token into the Fun class, you can directly Echo now ('Y-m-d H: I: s ', time (); // 00:13:40

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.