CMS Development

Myriad
Mitglied

Compare Dates in HUBL code - Find within the last 7 days

lösung

I am trying to use Hubl code to find if a date is within the last 7 days.  The date is coming from a HubDB table and appears to be saved as a UTC date in HubDB.  I'm doing this in code used to generate an email so using javascript in the solution is out.  My issue is the local_dt is not in UTC(can't seem to get UTC) and HubDB date is UTC.

 

In summary Hubl only code that would work like this:

If HubDBdate > (todaysDate - 7 days) then

 

(Again note using javascript is not an option, I have a solution working that way but the email builder won't with the javascript)

 

 

0 Upvotes
1 Akzeptierte Lösung
anthonypizzurro
Lösung
HubSpot-Produktteam
HubSpot-Produktteam

Compare Dates in HUBL code - Find within the last 7 days

lösung

Hi Myriad,

 

You can convert {{ local_dt }} to a timestamp using the HubL function {{ unixtimestamp( local_dt ) }}

 

More info here: http://designers.hubspot.com/en/docs/hubl/hubl-supported-functions#hs_cos_wrapper_widget_14858148265...

 

 

I hope that helps,

Anthony

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
1 Antwort
anthonypizzurro
Lösung
HubSpot-Produktteam
HubSpot-Produktteam

Compare Dates in HUBL code - Find within the last 7 days

lösung

Hi Myriad,

 

You can convert {{ local_dt }} to a timestamp using the HubL function {{ unixtimestamp( local_dt ) }}

 

More info here: http://designers.hubspot.com/en/docs/hubl/hubl-supported-functions#hs_cos_wrapper_widget_14858148265...

 

 

I hope that helps,

Anthony

0 Upvotes