开发者

Is there a jQuery date formatter plugin that handles multiple time zones and proper daylight savings time?

I live in Hawaii where there is no Daylight Savings Time. I'm trying to show a world clock that displays dates and times from different time zones, but I also need it to properly calculate the DST offset. The limitation is that I must use the client time, as the application will not be able to get internet access. Is there a jQuery plugin that can handle this, or do I have to write it开发者_JAVA技巧 manually?


Does it HAVE to be a jQuery plugin?

There is a project on github that prototypes the Javascript Date object to be able to handle timezone keys

Regardless of how you do it, you will have to get the tzinfo database to work with your script (well, that's the only way I know of that will give you robust information about DST around the world). I have no personal experience of the library I linked above, but people seem to mention it from time to time, and it is the only pure JavaScript lib I have found to the tzinfo database.


function get_time_zone_offset( ) {
     var current_date = new Date( );
     var gmt_offset = current_date.getTimezoneOffset( ) / 60;
     return gmt_offset;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜