Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created November 6, 2011 13:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyanny/1342852 to your computer and use it in GitHub Desktop.
Save kyanny/1342852 to your computer and use it in GitHub Desktop.
var d = new Date();
// "Sun Nov 06 2011 22:05:41 GMT+0900 (JST)"
function calcTime(offset){
var d = new Date();
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
var nd = new Date(utc + (3600000 * offset));
return nd;
}
var bombay = calcTime(5.5);
// "Sun Nov 06 2011 18:34:39 GMT+0900 (JST)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment