How do you handle timezone difference calculation in PHP?

前端 未结 4 1320
滥情空心
滥情空心 2020-12-11 20:37

I\'m being told that this below method of calculating the user\'s local time is sometimes not working. What\'s the best way to do this in PHP? What do you do?



        
4条回答
  •  伪装坚强ぢ
    2020-12-11 21:14

    Use the DateTime extension, such as DateTime::getOffset,
    or DateTimeZone::getOffset

    Some countries might have perform several timezone update,
    this method DateTimeZone::getTransitions reveal the transition history

提交回复
热议问题