Skip to content

Instantly share code, notes, and snippets.

@tfentonz
Last active March 10, 2016 01:17
Show Gist options
  • Save tfentonz/7175c04d2397d2dfd132 to your computer and use it in GitHub Desktop.
Save tfentonz/7175c04d2397d2dfd132 to your computer and use it in GitHub Desktop.
var date = new Date();
var dateString = [date.getFullYear(),
('0' + (date.getMonth() + 1)).slice(-2),
('0' + date.getDate()).slice(-2)].join('/');
dateString += ' ';
dateString += [('0' + date.getUTCHours()).slice(-2),
('0' + date.getUTCMinutes()).slice(-2),
('0' + date.getUTCSeconds()).slice(-2)].join(':');
dateString += ' +' + ((date.getTimezoneOffset() / 60) * -100);
postman.setGlobalVariable("yourVariable", dateString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment