Skip to content

Instantly share code, notes, and snippets.

@goelp
Last active April 11, 2018 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goelp/4fe0aee6c0eb0bf774e84ce0d0a0795b to your computer and use it in GitHub Desktop.
Save goelp/4fe0aee6c0eb0bf774e84ce0d0a0795b to your computer and use it in GitHub Desktop.
Timezone conversion in Javascript for Quickbooks API
/** Add hours to a given date object **/
Date.prototype.addHours = function(h) {
this.setTime(this.getTime() + (h*60*60*1000));
return this;
}
/** overall function to create QBO invoices **/
function generateInvoices(){
...
var invoiceDate = new Date();
invoiceDate.addHours(18); // to add 18 hours to the datetime object.
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment