How to format unixtimestamp to human readable date?

SOLVE
Highlighted
Resident Expert

The goal is to calculate a future date and display that future date in human readable format. I get the unixtimestamp calculation part (i think), but that's as far as I could get.

 

Here's the HubL code ... (live on the bottom of this dev page)

 

{% set future_days = 10|multiply(86400) %} {% set expiration_date = unixtimestamp(d)|add(future_days) %}
<h2>Today (uTime): {{ unixtimestamp(d) }} | Today (date): {{ unixtimestamp(d)|datetimeformat('%B %e, %Y') }}</h2>
<h2>Expiration (uTime): {{ expiration_date }} | Expiration (date): {{ expiration_date|datetimeformat('%B %e, %Y') }}</h2>

 

Q: Is there a best practice for calculating & displaying future dates in HubSpot email using HubL?

 

Thanks in advance for the help.

 

1 Accepted solution

Accepted Solutions
Regular Advisor | Gold Partner | HubSpot Certified Trainer

I think you're heading in the right direction with what you have @MFrankJohnson - HUBL is just a templating language, so, aside from light arithmatic, loops, if statements and strings, you're not going to find much help from HUBL since I haven't seen that anywhere in the docs.

It would be a nice feature though Smiley Very Happy

Reply
0 Upvotes
2 Replies
Regular Advisor | Gold Partner | HubSpot Certified Trainer

I think you're heading in the right direction with what you have @MFrankJohnson - HUBL is just a templating language, so, aside from light arithmatic, loops, if statements and strings, you're not going to find much help from HUBL since I haven't seen that anywhere in the docs.

It would be a nice feature though Smiley Very Happy

Reply
0 Upvotes
Resident Expert

 Thanks. Just needed to confirm I actually hit a wall. Guess the fact that it's not possible in HubL explains why I couldn't find documentation anywhere. haha Smiley Happy