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

SOLVE
Myriad
Member

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 Accepted solution

Accepted Solutions
anthonypizzurro
Solution
HubSpot Product Team

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

View solution in original post

0 Upvotes
1 Reply 1
anthonypizzurro
Solution
HubSpot Product Team

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

View solution in original post

0 Upvotes