php实现的太平洋时间和北京时间互转的自定义函数分享
没有什么好说的了,直接上代码吧:
/** * 太平洋时间转北京时间 */ public function pacificToPRC($time=''){ date_default_timezone_set('Pacific/Apia'); if(empty($time)){ $time = time(); } date_default_timezone_set('Asia/Shanghai'); $date = date('Y-m-d H:i:s',$time); $time = strtotime($date); return $time; } /** * 北京时间转太平洋时间 * @param unknown_type $time */ public function PRCToPacific($time=''){ if(empty($time)){ date_default_timezone_set('Asia/Shanghai'); $time = time(); } date_default_timezone_set('Pacific/Apia'); $date = date('Y-m-d H:i:s',$time); $time = strtotime($date); return $time; }
相关推荐
微米游戏开发团队 2017-11-28
Crazyshark 2020-11-13
klarclm 2020-06-13
songshijiazuaa 2020-06-13
spinachcqb 2020-05-29
olyqcool 2020-05-29
austindev 2020-05-08
amberom 2020-03-08
Nicolase 2020-02-25
jkzyx 2020-02-23
xuelang0 2020-01-24
Nicolase 2019-11-06
liuwendao 2016-11-04
CsdnGame 2016-05-11
怕什么真理无穷 2019-06-27
怕什么真理无穷 2019-06-26
jingxiao 2019-06-26
快雪时晴天 2010-04-24