# 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:** 17

<div class="post-metadata">

**Author:** ![MaxWCS](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@MaxWCS](https://community.hubspot.com/u/MaxWCS)\
**Post date:** [November 15, 2023, 8:44am UTC](https://community.hubspot.com/t/string-date-to-date-property-in-automation-workflow-with-custom-code/79501/17 "2023-11-15T08:44:13Z")

</div>

Hello,

Here is the good solution :

```lia-code-sample
exports.main = async (event, callback) => { 
const date = event.inputFields['date']; 
var sdateconvert = new Date(sdate).valueOf(); 

callback({ 
outputFields: 
{ 
sdateconvert: sdateconvert 
} 
}); 
}

```

You just need to convert in unix timestamp in **milliseconds**.

Cheers,

---

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