简体   繁体   English

jQuery DateTime Picker时区

[英]Jquery datetime picker timezone

I am using Jquery datetime picker. 我正在使用Jquery日期时间选择器。 $('.datepicker').datetimepicker(); I need to set timezone. 我需要设置时区。 Like America/New_york Is there any way to give in options ? America / New_york一样,有什么办法让步? Currently it is taking my system timezone. 目前正在占用我的系统时区。

http://momentjs.com/ is great library for timezone conversions. 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

and

By default, moment parses and displays in local time. 默认情况下,moment解析并以本地时间显示。

Hope help you. 希望对你有帮助。

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

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