for now, DateZ is intended to use in server-side scripts with Node.js (as i needed it). You can use npm for easy installation.
npm install DateZ
there is no reason not to use the same DateZ object for client-side scripting, so it is to be done in the future implementation.(i guess...)
DateZ has all the methods the Built-in Date object has, and works exactly the same except for the setTimezoneOffset addition described below.
.setTimezoneOffset( timezoneOffset, [ timezoneAbbreviation ] );
timezonOffset should be equivalent to the value you can get from Date.getTimezoneOffset().
i.e. GMT-0800 => 480, GMT+0900 => -540
timezoneAbbreviation is optional, and can be any string value. (You can even set "Mars Daylight savind Time" if you wish.) If not given here, timezone abbreviations will be omitted from the return values of any string related methods, such as toString(), toLocalString() and toTimeString(). Timezone values and their abbreviations are in one-to-many relationships, so there isn't an absolute way to pick out just one abbreviation unless you specify which abbreviation you mean to use.
var sys = require('sys'); var DateZ = require('DateZ').DateZ; //suppose your remote server is somewhere in PST zone, which is represented as GMT-0800 var now = new Date(); //built-in var nowZ = new DateZ(); //Z stands for time"Z"one btw sys.puts(now.toString()); sys.puts(nowZ.toString()); //now change the timezone of nowZ for JST(GMT+0900) nowZ.setTimezoneOffset(-540); sys.puts(now.toString()); sys.puts(nowZ.toString()); //note that timezone abbreviations are omitted unless you explicitly specify with setTimezoneOffset nowZ.setTimezoneOffset(-540, 'JST'); sys.puts(nowZ.toString());
and that's about it for now.