# Problem in date format conversion using javascript

**URL:** <https://community.automationedge.com/t/problem-in-date-format-conversion-using-javascript/3522>\
**Category:** Process Studio\
**Tags:** rpa, process-studio\
**Created:** [June 4, 2021, 6:06am UTC](https://community.automationedge.com/t/problem-in-date-format-conversion-using-javascript/3522 "2021-06-04T06:06:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shubhamautomation](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.automationedge.com/shubhamautomation/32/604_2.png) [@Shubhamautomation](https://community.automationedge.com/u/Shubhamautomation)\
**Post date:** [June 4, 2021, 6:06am UTC](https://community.automationedge.com/t/problem-in-date-format-conversion-using-javascript/3522/1 "2021-06-04T06:06:53Z")

</div>

Hello,  
I am getting the current date using **get system info step** and want to convert it into **different format.** but it is giving the error if I use **str2date** function. (See Snapshot)

 ![date format error](https://canada1.discourse-cdn.com/flex027/uploads/automationedge/original/1X/a52a4184c8a41bf97137adb5fce18b367bf22b37.png)

In Question it is mentioned that ( **Maintain its DataType as Date** ).  
I can make date into different format by extracting **Date ,month , Year** individually and concat them later into particluar format.  
but in question it asked for Maintain DataType as Date.

---

<div class="post-metadata">

**Author:** ![aditya.devi](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@aditya.devi](https://community.automationedge.com/u/aditya.devi)\
**Post date:** [July 9, 2021, 10:36am UTC](https://community.automationedge.com/t/problem-in-date-format-conversion-using-javascript/3522/3 "2021-07-09T10:36:54Z")

</div>

Please use date2str(Todays\_date, “dd-MM-yyyy”) instead of str2date(Todays\_date, “dd-mm-yyyy”);

---

<div class="post-metadata">

**Author:** ![Shubhamautomation](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.automationedge.com/shubhamautomation/32/604_2.png) [@Shubhamautomation](https://community.automationedge.com/u/Shubhamautomation)\
**Post date:** [July 9, 2021, 11:43am UTC](https://community.automationedge.com/t/problem-in-date-format-conversion-using-javascript/3522/4 "2021-07-09T11:43:52Z")

</div>

> [@aditya.devi](#):
>
> date2str

**date2str** function is working. I think Because of its **datatype object** I was not able to convert using **str2date**.

 ![dateformat](https://canada1.discourse-cdn.com/flex027/uploads/automationedge/original/1X/ca1e21e6c1d8e982b878f23a56d5afdd3b80dbc6.png)
