This article mainly introduces the sharing of the Pacific time and custom functions implemented by php and the Beijing time, mainly through the date_default_timezone_set function. if you need a friend, you can refer to the following, go directly to the code:
/*** Pacific time to Beijing time */public function pacificToPRC ($ time = '') {date_default_timezone_set ('pacpacific/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 ;} /*** Beijing time to Pacific time * @ param unknown_type $ time */public function PRCToPacific ($ time = '') {if (empty ($ time )) {date_default_timezone_set ('Asia/Shanghai'); $ time = time ();} date_default_timezone_set ('pacpacific/Apia '); $ date = date ('Y-m-d H: i: S', $ time); $ time = strtotime ($ date); return $ time ;}