dplht39359 2013-06-06 22:48
浏览 36

在服务器上将客户端时间转换为UTC以进行存储[重复]

This question already has an answer here:

This may be a duplicate but I can't seem to find what I'm looking for.

I want to store dates given by the client in UTC. I have a javascript library that detects the client's timezone and I'm sending the timezone name (e.g. America/Halifax) to the server with the rest of the form data.

I've been searching now for the php functions that I can use to take the date entered and the timezone and convert it to UTC.

I think gmdate is the correct function but how do I use the date entered and the timezone with gmdate?

</div>
  • 写回答

1条回答 默认 最新

  • dousi3362 2013-06-06 22:50
    关注

    Try setting date_default_timezone_set('America/Halifax') at the top of your script.

    http://php.net/manual/en/timezones.php

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度