# How can i append date from csv file

**URL:** <https://community.postman.com/t/how-can-i-append-date-from-csv-file/65306>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [August 7, 2024, 7:40am UTC](https://community.postman.com/t/how-can-i-append-date-from-csv-file/65306 "2024-08-07T07:40:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahaisha](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mahaisha](https://community.postman.com/u/mahaisha)\
**Post date:** [August 7, 2024, 7:40am UTC](https://community.postman.com/t/how-can-i-append-date-from-csv-file/65306/1 "2024-08-07T07:40:39Z")

</div>

I need to send date in yyy-mm-dd format. I am doing data driven from csv file, now the problem is, eveyrym i close the file the formatting goes away and the date has to be unique for every request i send.  
How i can set date in unique formate for every run reading from csv or without or without csv

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [August 7, 2024, 8:54am UTC](https://community.postman.com/t/how-can-i-append-date-from-csv-file/65306/2 "2024-08-07T08:54:36Z")

</div>

If you can’t save back over the CSV file with the desired format, then you will need to use a pre-request script to read the date column from the CSV file .

Then use moment to format the data to the desired format before saving it to an collection or environment variable so it can be used in the request.

---

<div class="post-metadata">

**Author:** ![mahaisha](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mahaisha](https://community.postman.com/u/mahaisha)\
**Post date:** [August 7, 2024, 1:46pm UTC](https://community.postman.com/t/how-can-i-append-date-from-csv-file/65306/3 "2024-08-07T13:46:19Z")

</div>

Can u plz tell me the code for that. Have nt used moment before

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [August 7, 2024, 3:27pm UTC](https://community.postman.com/t/how-can-i-append-date-from-csv-file/65306/4 "2024-08-07T15:27:40Z")

</div>

Have you tried searching the forum, or the Postman Learning Centre?

The following is a basic example.

```auto
let moment = require('moment');
let currentDate = moment(new Date()).format("YYYY-MM-DD");
console.log(currentDate);

```

---

<div class="post-metadata">

**Author:** ![mahaisha](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mahaisha](https://community.postman.com/u/mahaisha)\
**Post date:** [August 7, 2024, 4:24pm UTC](https://community.postman.com/t/how-can-i-append-date-from-csv-file/65306/5 "2024-08-07T16:24:15Z")

</div>

Thank you, exploring on the same

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [September 25, 2024, 10:27am UTC](https://community.postman.com/t/how-can-i-append-date-from-csv-file/65306/7 "2024-09-25T10:27:58Z")

</div>

Closed on September 25, 2024, 10:27am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
