# Use workflow to format a timestamp string to date picker

**URL:** <https://community.hubspot.com/t/use-workflow-to-format-a-timestamp-string-to-date-picker/92083>\
**Category:** Data Hub\
**Created:** [October 18, 2023, 2:55pm UTC](https://community.hubspot.com/t/use-workflow-to-format-a-timestamp-string-to-date-picker/92083 "2023-10-18T14:55:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LDeBenedetti](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@LDeBenedetti](https://community.hubspot.com/u/LDeBenedetti)\
**Post date:** [October 18, 2023, 2:55pm UTC](https://community.hubspot.com/t/use-workflow-to-format-a-timestamp-string-to-date-picker/92083/1 "2023-10-18T14:55:11Z")

</div>

Hi folks,

I’d like your help on how may I build this workflow.. We use an app called Clearout for verifying the email status.

One of the default properties (Single Line text format) synced to Hubspot is “Clearout verified on” wich contains a timestamp string

2023-10-18T12:25:12.590Z

I’d like to build a custom code workflow where I can use this value and format it as Date Picker so it can be used on reports/lists.

How may I do that?

Thanks!

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [October 19, 2023, 10:04am UTC](https://community.hubspot.com/t/use-workflow-to-format-a-timestamp-string-to-date-picker/92083/2 "2023-10-19T10:04:49Z")

</div>

Hey @LDeBenedetti, I hope that you are doing well!  
It’s a pleasure to see you asking on the Community!  
You’d like to use a custom code in a workflow to format a timestamp string to date picker, right?  
I found these threads that might be of interest to you:  
- The solution from @Bryantworks on this post “[Simple String to Date Workflow using Custom Code](https://community.hubspot.com/t5/APIs-Integrations/Simple-String-to-Date-Workflow-using-Custom-Code/td-p/485400)”  
- The solution from @Kevin-C on this post “[String date to date property in automation/workflow with custom code](https://community.hubspot.com/t5/APIs-Integrations/String-date-to-date-property-in-automation-workflow-with-custom/m-p/784351?profile.language=ja)”  
I also wanted to invite a couple of subject matter experts to this conversation @HFisher7, @ChrisoKlepke and @ChristinaKay do you have any advice to help @LDeBenedetti, please?  
**If anybody else has anything to add and/or share, please feel free to join in the conversation** 🙂  
Thank you and have a fabulous day!  
Best,  
Bérangère

---

<div class="post-metadata">

**Author:** ![LDeBenedetti](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@LDeBenedetti](https://community.hubspot.com/u/LDeBenedetti)\
**Post date:** [October 20, 2023, 10:10am UTC](https://community.hubspot.com/t/use-workflow-to-format-a-timestamp-string-to-date-picker/92083/3 "2023-10-20T10:10:39Z")

</div>

Hey,

Thanks for your response.. here’s what I got but still on error…

exports.main = async (event, callback) =\> {

const co\_vryon = event.inputFields[‘co\_vryon’];

const date = new Date(co\_vryon);

const co\_vryon = date.toISOString();

console.log(co\_vryon);

callback({ outputFields: {

date: clearout\_verified\_date

}

});

}

co\_vryon is a single line text property containing the timestamp 2023-10-19T08:32:23.279Z

clearout\_verified\_date is a property with format date picker

Any suggestions?

 ![LDeBenedetti_0-1697796635885.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/8/7/87fdb8c7f353a1ba68a7525e25281542f09f2b04.png)

---

<div class="post-metadata">

**Author:** ![Maciek-Magic](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Maciek-Magic](https://community.hubspot.com/u/Maciek-Magic)\
**Post date:** [October 24, 2023, 2:08pm UTC](https://community.hubspot.com/t/use-workflow-to-format-a-timestamp-string-to-date-picker/92083/4 "2023-10-24T14:08:07Z")

</div>

Hi,  
As per documentation, HubSPot accepts Date Picker date format as YYYY-MM-DD  
[HubSpot Developer Documentation - HubSpot docs](https://developers.hubspot.com/docs/api/faq#:~:text=For%20values%20that%20represent%20a,e.g.%202020%2D02%2D29))  
You have from Clearout timestamp in format as 2023-10-18T12:25:12.590Z

```lia-code-sample
let timestamp = "2023-10-18T12:25:12.590Z"
let datePicker = timestamp.split('T')[0]

console.log(datePicker)

```

That should work

```lia-code-sample
let unixTimestamp = "1698156364"
let date = new Date(parseInt(unixTimestamp *1000))
 let datePicker = date.toISOString().split('T')[0]
console.log(date)
console.log(datePicker)

```

If you would have timestamp as as Unix format then you need to convert it

```lia-code-sample
let unixTimestamp = "1698156364"
let date = new Date(parseInt(unixTimestamp *1000))
 let datePicker = date.toISOString().split('T')[0]
console.log(date)
console.log(datePicker)

```
