<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Fetch and format date in Workflow in Data Hub</title>
    <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/988865#M2364</link>
    <description>&lt;P&gt;Hey &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/582826"&gt;@svamann&lt;/a&gt;&lt;/SPAN&gt;, Happy Friday!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like you're encountering an issue with formatting a date in your workflow. Ensure that the date format returned by your custom code matches the expected format for the Format data step. The Format data step might require a specific date format (e.g., ISO 8601).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To our top experts &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/123775"&gt;@danmoyle&lt;/a&gt;&lt;/SPAN&gt; and &lt;SPAN style="color:rgb(0,145,174);font-size:12px;"&gt;&lt;STRONG&gt;&lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/313109"&gt;@HFisher7&lt;/a&gt;&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;do you have any recommendations for &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/582826"&gt;@svamann&lt;/a&gt;&lt;/SPAN&gt; matter?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pam&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2024 15:33:34 GMT</pubDate>
    <dc:creator>PamCotton</dc:creator>
    <dc:date>2024-06-07T15:33:34Z</dc:date>
    <item>
      <title>Fetch and format date in Workflow</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/988646#M2363</link>
      <description>&lt;P&gt;I have a workflow that fetches a Date property from a custom object in custom code and returns this.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-06-07 at 10.37.39.png" style="width: 289px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/119238i142508E2B582AB4E/image-dimensions/289x34?v=v2" width="289" height="34" role="button" title="Screenshot 2024-06-07 at 10.37.39.png" alt="Screenshot 2024-06-07 at 10.37.39.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This steps works like a charm, returning the expected value when I test it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-06-07 at 10.37.16.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/119237iF34D31AB9E7096D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-06-07 at 10.37.16.png" alt="Screenshot 2024-06-07 at 10.37.16.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now at a later point in the same workflow, I try to format the date for display purposes, depending on conversation language, so there's multiple branches doing a different formatting each. Since event_start is a Date (tried Datetime as well), I assumed I can use a Format data step like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-06-07 at 10.40.27.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/119239i36EB040B38B249A0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-06-07 at 10.40.27.png" alt="Screenshot 2024-06-07 at 10.40.27.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this step fails when the workflow runs. Its kinda hard to debug, because the log just says "Action failed" without any more details. I assume that somehow the format of event_start does not match the expectations of the Format data step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before I now replace the Format data step by another custom code, I would be curious whether I'm doing something wrong or whether this is indeed not possible this way &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 08:44:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/988646#M2363</guid>
      <dc:creator>svamann</dc:creator>
      <dc:date>2024-06-07T08:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch and format date in Workflow</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/988865#M2364</link>
      <description>&lt;P&gt;Hey &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/582826"&gt;@svamann&lt;/a&gt;&lt;/SPAN&gt;, Happy Friday!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like you're encountering an issue with formatting a date in your workflow. Ensure that the date format returned by your custom code matches the expected format for the Format data step. The Format data step might require a specific date format (e.g., ISO 8601).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To our top experts &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/123775"&gt;@danmoyle&lt;/a&gt;&lt;/SPAN&gt; and &lt;SPAN style="color:rgb(0,145,174);font-size:12px;"&gt;&lt;STRONG&gt;&lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/313109"&gt;@HFisher7&lt;/a&gt;&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;do you have any recommendations for &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/582826"&gt;@svamann&lt;/a&gt;&lt;/SPAN&gt; matter?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pam&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 15:33:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/988865#M2364</guid>
      <dc:creator>PamCotton</dc:creator>
      <dc:date>2024-06-07T15:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch and format date in Workflow</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/990312#M2368</link>
      <description>&lt;P&gt;Honestly I'd tag in&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/363300"&gt;@Jnix284&lt;/a&gt;&amp;nbsp;on this one. I think she's done some custom coding in workflows - more than me, anyway!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 12:49:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/990312#M2368</guid>
      <dc:creator>danmoyle</dc:creator>
      <dc:date>2024-06-11T12:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch and format date in Workflow</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994010#M2386</link>
      <description>&lt;P&gt;Thanks for the tag&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/123775"&gt;@danmoyle&lt;/a&gt;&amp;nbsp;and I apologize for the delayed response&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/582826"&gt;@svamann&lt;/a&gt;&amp;nbsp;- were you able to solve the issue with your CCA?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 19:35:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994010#M2386</guid>
      <dc:creator>Jnix284</dc:creator>
      <dc:date>2024-06-18T19:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch and format date in Workflow</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994096#M2388</link>
      <description>I worked around it with custom code. Works, but I would sure like to understand why the formatting action fails… would be much more convenient to just use the native formatting action!&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Jun 2024 23:34:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994096#M2388</guid>
      <dc:creator>svamann</dc:creator>
      <dc:date>2024-06-18T23:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch and format date in Workflow</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994110#M2389</link>
      <description>&lt;P&gt;I'm glad you found a solution&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/582826"&gt;@svamann&lt;/a&gt;, without rebuilding the workflow and CCA, it'd be hard to say why it failed based on the info provided.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 00:58:09 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994110#M2389</guid>
      <dc:creator>Jnix284</dc:creator>
      <dc:date>2024-06-19T00:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch and format date in Workflow</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994217#M2392</link>
      <description>&lt;P&gt;So what information would you need to answer this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm fetching the date property from the API in my custom code.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-06-19 at 08.41.15.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/120022iB1F8B975F1088900/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-06-19 at 08.41.15.png" alt="Screenshot 2024-06-19 at 08.41.15.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and return the value as is&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-06-19 at 08.42.12.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/120024i3019FBCEB8868C46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-06-19 at 08.42.12.png" alt="Screenshot 2024-06-19 at 08.42.12.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The return type is declared as Date (using DateTime, makes no difference). And displays as "2024-06-12" when I test the step (see the screenshot in my original post above).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This output I seen directly feed into the format-date action.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the above a gather that this might be an issue of the data format. I assumed that any "Date" would fit into a format date step and I can't find any explicit requirement on the date format of such a step. If there is, I'd appreciate a pointer!&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 06:46:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994217#M2392</guid>
      <dc:creator>svamann</dc:creator>
      <dc:date>2024-06-19T06:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch and format date in Workflow</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994368#M2393</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/582826"&gt;@svamann&lt;/a&gt;&amp;nbsp;you said that it doesn't matter if you use Date or DateTime, but there is a differentiation in the backend - how is start_date defined? Is it a date picker (date) or DateTime?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the &lt;A href="https://developers.hubspot.com/docs/api/faq#:~:text=For%20values%20that%20represent%20a,%2DDDThh%3Amm%3Ass." target="_blank" rel="noopener"&gt;dev doc for Date vs DateTime&lt;/A&gt; - I think this is the source of the error&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 11:38:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994368#M2393</guid>
      <dc:creator>Jnix284</dc:creator>
      <dc:date>2024-06-19T11:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch and format date in Workflow</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994374#M2394</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/363300"&gt;@Jnix284&lt;/a&gt;&amp;nbsp;it's a date picker. Choosing either Date or DateTime for the custom code output does not make an observable difference in the output I see when testing the custom code action (it's "yyyy-mm-dd" in both cases) and in the error I see from the format date action. There may, of course, be a difference in what happens under the hood.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the link, it explains the output format of the API, which matches what I see when testing my custom code action. Is there also documentation on the expected input format of the format date action?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I always thought it's just not possible to create DateTime custom properties at all, now I learned it's possible via the API! Thanks for this insight &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 11:53:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/994374#M2394</guid>
      <dc:creator>svamann</dc:creator>
      <dc:date>2024-06-19T11:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch and format date in Workflow</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/1046276#M2573</link>
      <description>&lt;P&gt;I just figured this out at last. The custom code (Python in my case) needs to return the date as a timestamp in milliseconds and ensure that it is an integer. As in&lt;/P&gt;&lt;LI-CODE lang="python"&gt;int(mydatetime.timestamp() * 1000)&lt;/LI-CODE&gt;&lt;P&gt;Then returning this from the custom code as a "Date" and using it in a Format Date action or writing it to a DatePicker property does work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See also &lt;A href="https://community.hubspot.com/t5/128172-RevOps-Discussions/Custom-Code-to-change-Date-Time-stamp-to-Date/m-p/1046272/highlight/true#M2699" target="_blank" rel="noopener"&gt;this community thread&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 09:19:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Fetch-and-format-date-in-Workflow/m-p/1046276#M2573</guid>
      <dc:creator>svamann</dc:creator>
      <dc:date>2024-09-26T09:19:38Z</dc:date>
    </item>
  </channel>
</rss>

