简体   繁体   English

用PHP中的新时区替换日期时间

[英]Replace date time with new timezone in PHP

I got string like: 我有这样的字符串:

[ 15.04.2012 15:48:03 ] blahblah
[ 17.02.2012 22:49:11 ] blahblah
[ 18.11.2011 10:11:39 ] blahblah

the date time is utc, how can I replace these date time strings with utc+8 date time? 日期时间是utc,如何将这些日期时间字符串替换为utc + 8日期时间?

If you know the timezone is +0 and you want to change it to utc+8 why not just add 8 hours? 如果您知道时区为+0,并且想将其更改为utc + 8,为什么不加8小时呢?

echo date('d.m.Y G:i:s', strtotime('+8 hours', strtotime('15.04.2012 15:48:03')));
// 15.04.2012 23:48:03

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM