【问题标题】:Jquery datetime picker timezoneJquery 日期时间选择器时区
【发布时间】:2016-12-30 00:45:10
【问题描述】:

我正在使用 Jquery 日期时间选择器。 $('.datepicker').datetimepicker(); 我需要设置时区。像 America/New_york 有没有办法让步?目前它正在占用我的系统时区。

【问题讨论】:

  • 您能指定您使用的日期时间选择器吗?
  • 我正在使用 Jquery 日期时间选择器。

标签: javascript jquery timezone datetimepicker


【解决方案1】:

http://momentjs.com/ 是一个很棒的时区转换库。

var newYork    = moment.tz("2016-06-01 12:00", "America/New_York");
var losAngeles = newYork.clone().tz("America/Los_Angeles");
var london     = newYork.clone().tz("Europe/London");

newYork.format();    // 2016-06-01T12:00:00-04:00
losAngeles.format(); // 2016-06-01T09:00:00-07:00
london.format();     // 2016-06-01T17:00:00+01:00

默认情况下,moment 解析并显示为当地时间。

希望能帮到你。

【讨论】:

  • 太棒了! !它有帮助。 .
猜你喜欢
  • 2012-09-11
  • 1970-01-01
  • 1970-01-01
  • 2011-03-27
  • 2015-08-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多