Skip to content

Instantly share code, notes, and snippets.

@matisnape
Last active January 16, 2018 11:09
Show Gist options
  • Save matisnape/16a6cc745f6533b940a046abbb4d7f04 to your computer and use it in GitHub Desktop.
Save matisnape/16a6cc745f6533b940a046abbb4d7f04 to your computer and use it in GitHub Desktop.
Postman snippets
// date format 2014-12-21T11:32:26.341Z
date = new Date().toISOString();
postman.setEnvironmentVariable("date", date);
// timestamp example: 1515684365
let randomized = Math.floor(Date.now() / 1000);
postman.setEnvironmentVariable("randomized", randomized);
// past date
date = new Date();
date.setFullYear(2014);
// date format YYYY.MM.DD hh:mm:ss
start = new Date().toJSON().split(/[TZ.]/).slice(0, 2).join(' ').replace(/-/g, '.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment