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