【发布时间】:2018-07-20 19:58:03
【问题描述】:
我的问题是:
- 究竟什么是 unix 纪元时间戳?
- 如何在 PHP 中使用它进行转换?
- 如何根据客户端时区进行转换?
我尝试了很多示例来获取客户端时区:
但我没有机会。
我终于尝试了这个来获取客户端时区,但再也没有机会了:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var tz = jstz.determine(); // Determines the time zone of the browser client
var timezone = tz.name(); //'Asia/Kolhata' for Indian Time.
$.post("url-to-function-that-handles-time-zone", {tz: timezone}, function(data) {
//Preocess the timezone in the controller function and get
//the confirmation value here. On success, refresh the page.
});
});
</script>
【问题讨论】:
标签: javascript jquery unix-timestamp