# Postman TodayDate variable to get past dates

**URL:** <https://community.postman.com/t/postman-todaydate-variable-to-get-past-dates/22290>\
**Category:** Help Hub\
**Tags:** variables, scripts\
**Created:** [April 5, 2021, 10:24pm UTC](https://community.postman.com/t/postman-todaydate-variable-to-get-past-dates/22290 "2021-04-05T22:24:06Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![bpricilla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/bpricilla/32/6511_2.png) [@bpricilla](https://community.postman.com/u/bpricilla)\
**Post date:** [April 7, 2021, 3:54am UTC](https://community.postman.com/t/postman-todaydate-variable-to-get-past-dates/22290/4 "2021-04-07T03:54:08Z")

</div>

@mattschmitt No problem 😊 I thought any past date would work for you.

So please try the below snippet then:

```auto
const moment = require('moment');
const today = moment();
var todayDate = today.format('YYYYMMDD');
pm.globals.set("todayDate", todayDate);

var tenDaysBack = moment().subtract(10, 'days');
//console.log(tenDaysBack);
pm.globals.set("tenDaysBack", tenDaysBack.format('YYYYMMDD'));

```

Please let me know if you still face any issues here 🙂

---

_[View the full topic](https://community.postman.com/t/postman-todaydate-variable-to-get-past-dates/22290)._
