# String date to date property in automation/workflow with custom code

**URL:** <https://community.hubspot.com/t/string-date-to-date-property-in-automation-workflow-with-custom-code/79501>\
**Category:** APIs & Integrations\
**Tags:** python, workflows\
**Created:** [April 18, 2023, 1:04am UTC](https://community.hubspot.com/t/string-date-to-date-property-in-automation-workflow-with-custom-code/79501 "2023-04-18T01:04:16Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [April 18, 2023, 7:08pm UTC](https://community.hubspot.com/t/string-date-to-date-property-in-automation-workflow-with-custom-code/79501/14 "2023-04-18T19:08:06Z")

</div>

Hey @VNguyen0

You might just be over thinking it! Have you tried the .parse() method?

```lia-code-sample
var ca_date = event.inputFields['ca_date'];
const unixTimeStamp = Date.parse(ca_date);

```

This should output a unixtimestamp in milliseconds, which is compatable with HS. You may want to do alittle additional modifiation if the time is important:

```lia-code-sample
var ca_date = event.inputFields['ca_date'];
const unixTimeStamp = Date.parse(ca_date);
// set time to midnight to be compatable with HS date property
const midnightUnix = unixTimeStamp.setHours(0,0,0); // date.setHours(hours,minutes,seconds);
console.log(midnightUnix);

```

---

_[View the full topic](https://community.hubspot.com/t/string-date-to-date-property-in-automation-workflow-with-custom-code/79501)._
