Dynamic variable timestamp in milliseconds

Hi!

I would like to have a dynamic timestamp in milliseconds, eg. {{$timestampMs}}. https://learning.postman.com/docs/writing-scripts/script-references/variables-list/

What I do now is setting a variable in Pre-request Script

pm.variables.set("timestampMs", new Date().getTime());

I don’t want to do that in every request i need a timestamp in ms.

I thought this would be a common case but I haven’t found any other requests for it.

Unfortunately, there is no predefined Postman variable. But you can add this script to your collection and it will be available to all requests.

Each request will have a newly generated value.

1 Like

Yes, thanks. That’s a bit better. A predefined variable would be preferable, but that will have to do.

1 Like