PHP custom function to convert American time to Beijing time

WBOY
Release: 2016-07-25 08:53:00
Original
1234 people have browsed it
  1. function datezhuanhuan($dateparams)
  2. {
  3. $ccc=strtotime($dateparams);
  4. $date=date('Y-m-d');
  5. $bjtime=date('Y-m-d',$ccc );
  6. if($date==$bjtime)
  7. {
  8. $sbjtime=date('Y-m-d H:i:s',$ccc);
  9. echo substr($sbjtime,11,5);
  10. } // bbs .it-home.org
  11. else
  12. {
  13. $sbjtime=date('Y-m-d H:i:s',$ccc);
  14. return substr($sbjtime,5,5);
  15. }
  16. }
Copy code

Attached, another +8 hour algorithm:

  1. $bj_time = date ("Y-m-d H:i:s" , mktime(gmdate('H')+8,gmdate('i'),gmdate('s'),gmdate('m' ),gmdate('d'),gmdate('Y')));
Copy code


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!