Converting $timestamp to ISO 8601


How can I convert $timestamp to ISO8601 format in a pre-request script?

This page on Stack Overflow has a function to do it, but neither Date() nor toISOString() seem to be available.


Dynamic variables (like $timestamp) cannot be used in the Sandbox. You can only use them in the {{..}} format in the request URL / headers / body.


var dateIso = new Date().toISOString();

Good reference:


Me too!! I mean… for all ISO date needs, I fall back to the code snippet that @matt posted.

However, if I have to do heavy date lifting, Postman Sandbox has the powerful “moment” library built in - more at

var moment = require('moment');

Docs of moment:


Thank you. That worked beautifully!

@shamasis, Thank you, I’ll check that when I have some free time.