# POST Date and Time to endpoint?

**URL:** <https://community.postman.com/t/post-date-and-time-to-endpoint/23116>\
**Category:** Help Hub\
**Created:** [April 26, 2021, 3:22pm UTC](https://community.postman.com/t/post-date-and-time-to-endpoint/23116 "2021-04-26T15:22:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vished](https://avatars.discourse-cdn.com/v4/letter/v/4bbf92/32.png) [@vished](https://community.postman.com/u/vished)\
**Post date:** [April 26, 2021, 3:22pm UTC](https://community.postman.com/t/post-date-and-time-to-endpoint/23116/1 "2021-04-26T15:22:45Z")

</div>

Hi,

I´m new to use Postman.

I´m currently try to call a POST request to my endpoint via JSON, return a JSON, but the data / time seems like the issue.

I would like to have a global parameter for:

- Time
- Date
- DateTime

What I tried so far for this:  
 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/e/e758afdc28ab68ef82bb7564cd8fa8eb4220d61c.png)

![image](https://us1.discourse-cdn.com/getpostman/original/3X/a/a/aae69771cc0162a35e40fd26b159184b90a30ba2.png)

But I got also no error message, only a Status = 500 ?

---

<div class="post-metadata">

**Author:** ![katevolkova](https://avatars.discourse-cdn.com/v4/letter/k/c89c15/32.png) [@katevolkova](https://community.postman.com/u/katevolkova)\
**Post date:** [April 26, 2021, 8:03pm UTC](https://community.postman.com/t/post-date-and-time-to-endpoint/23116/2 "2021-04-26T20:03:17Z")

</div>

Hey Vished,

If you want a global variable, you could try this in Pre-request Script:

```
let current = new Date();
let cDate = current.getFullYear() + '-' + (current.getMonth() + 1) + '-' + current.getDate();
let cTime = current.getHours() + ":" + current.getMinutes() + ":" + current.getSeconds();
let dateTime = cDate + ' ' + cTime;

pm.globals.set("current_date", dateTime);

```

 ![2021-04-26 в 22.02.13](https://us1.discourse-cdn.com/getpostman/original/3X/7/f/7f26d7da9001d525acefafddf29ef23f7980e94a.png)
