问题描述:

How can I display a date to behave like that day regardless of the users time-zone?

>>> new Date('2013-09-17')

Date {Mon Sep 16 2013 20:00:00 GMT-0400 (Eastern Standard Time)}

I'm trying to use the jquery datepicker formater, however when I pass the date object it's off by a day.

How can I make sure that the users timezone is disregarded?

网友答案:

OK, I split the string and passed them as parameters for my expected result.

>>> d = '2013-09-17'.split('-');  new Date(d[0],d[1]-1,d[2]);
Date {Thu Oct 17 2013 00:00:00 GMT-0400 (Eastern Standard Time)}
相关阅读:
Top