CMS Development

MFrankJohnson
Thought Leader

How to format unixtimestamp to human readable date?

SOLVE

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.

 

 

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com
1 Accepted solution
tjoyce
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to format unixtimestamp to human readable date?

SOLVE

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 😄

View solution in original post

0 Upvotes
2 Replies 2
tjoyce
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to format unixtimestamp to human readable date?

SOLVE

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 😄

0 Upvotes
MFrankJohnson
Thought Leader

How to format unixtimestamp to human readable date?

SOLVE

 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 🙂

 

 

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com