How to pass current date as a value in GET request

I want to give current date as a value for (date = current date) parameter in GET request

Hey @immanuelsamuel

Welcome to the community! :wave:

Your question isn’t really giving people enough information to help you out.

Can you take a look through this post and edit your question and provide more context and detail please.

1 Like


Welcome to the community :wave:

As Danny suggested above, kindly read that post and make sure to give enough details when you post a query.

But from the info you have provided, I think you are trying to pass a variable with current date every-time you run the GET request.

Please include the below snippet in your pre-request Script section.

var moment = require('moment');

pm.environment.set('currentdate', moment().format(("YYYY-MM-DD")));

{{$timestamp}} -> predefined variable gets the current timestamp, Since you need date the above one should work.

use the parameter {{currentdate}} in your GET request.

If you are having a different issue, kindly provide more details.

1 Like

You perfectly understood my question, yeah from now on I will try to give more details.
But the answer you provided is not working it’s throwing the below error.

@immanuelsamuel: Kindly edit the quotes. Its issue with copy paste here. It should look like:

It works wonderfully now, thanks @bpricilla.

1 Like

Just a friendly word of advice :smile: - If you’re sharing code snippets on here just simply wrap the code block in 3 backticks (```) by doing this you don’t get the formatting issues that you’re seeing.

It makes it 100% more readable :smile:

For example:

without backticks :no_entry:

“test”: message

with backticks :trophy:


Sure Danny, noted :grinning: Thanks for sharing that.

may this blog help you @immanuelsamuel :slight_smile: