简体   繁体   中英

Jquery datetime picker timezone

I am using Jquery datetime picker. $('.datepicker').datetimepicker(); I need to set timezone. Like America/New_york Is there any way to give in options ? Currently it is taking my system timezone.

http://momentjs.com/ is great library for timezone conversions.

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.

Hope help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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