CMS Development

vikram-mit
Participant

inserting date into email template

Résolue

i have email template for our lead follow up emails where we usually suggest a date 2 business days of sending the email. currently, it is a pain to manually update the date every time we send email. is there a way to insert it dynamically the way we can do the personalization attributes?

1 Solution acceptée
alyssamwilie
Solution
Expert reconnu | Partenaire solutions Elite
Expert reconnu | Partenaire solutions Elite

inserting date into email template

Résolue

@LoraBergeron 

You can use the plus_time filter to get a future date from the current date, like so:

{% set future_date = local_dt|plus_time(21, 'days')%}
{{ datetimeformat(future_date, '%B %e, %Y') }}

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

Voir la solution dans l'envoi d'origine

33 Réponses
Glay_Imutan
Participant | Partenaire solutions Diamond
Participant | Partenaire solutions Diamond

inserting date into email template

Résolue

Hello Alyssa,

 

Is there a way how to change the format of personalization tokens? For example, instead of 7/14/2022, the output will be Jul 14, 2022.

 
Here's what it looks like from the source code:

Screen Shot 2021-08-24 at 8.30.30 PM.png

 

Thank you in advance.

alyssamwilie
Expert reconnu | Partenaire solutions Elite
Expert reconnu | Partenaire solutions Elite

inserting date into email template

Résolue

@Glay_Imutan I believe using the filter instead of the function is better suited for personalization tokens:

 

{{ company.subscription_end_date|datetimeformat('%b %e, %Y') }}

 

 

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
Glay_Imutan
Participant | Partenaire solutions Diamond
Participant | Partenaire solutions Diamond

inserting date into email template

Résolue

That was fast! Thanks Alyssa. I tried the script above however I think I missed something? 

Here's what it looks like from the source code:

Screen Shot 2021-08-25 at 2.30.02 AM.png

It doesn't reflect the date as it should be. It appears blank on the "preview" mode:

 

Screen Shot 2021-08-25 at 1.56.26 AM.png

 

What could be the problem? 

alyssamwilie
Expert reconnu | Partenaire solutions Elite
Expert reconnu | Partenaire solutions Elite

inserting date into email template

Résolue

@Glay_Imutan Sorry, I completely missed that this post was about email. Unfortantely, Hubspot does not support formatting on contact properties in email. 😔

 

As stated in their documentation :
"Please note that using filters on any personalization variables (such as but not limited to contacts, company, and deal variables) is not currently supported for email in HubSpot due to how emails are rendered"

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
Glay_Imutan
Participant | Partenaire solutions Diamond
Participant | Partenaire solutions Diamond

inserting date into email template

Résolue

Oh no worries! thanks for checking and for helping me. Greatly appreciate your effort 😃

 

I'll just use zapier to do the format. 

CCassidy
Membre

inserting date into email template

Résolue

This is great!!

I've been looking through HubL, some really good stuff. 

One more additional question on this one.

 

in a workflow within an email can I set the date as 'end of the month' for example: Available until the end of May

So then June arrives and it will prepopulate to now be Available until the end of June.

 

Thank you in advance.

0 Votes
alyssamwilie
Expert reconnu | Partenaire solutions Elite
Expert reconnu | Partenaire solutions Elite

inserting date into email template

Résolue

@CCassidy You can grab the current month like so :

{{ datetimeformat(local_dt, '%B') }} 

So at the time of me posting this that code would output "May" then on June 1st it'll start outputting "June".

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
alyssamwilie
Expert reconnu | Partenaire solutions Elite
Expert reconnu | Partenaire solutions Elite

inserting date into email template

Résolue

@vikram-mit 

You don't need a personalization token or workflow. You just need one little line of HubL -

 

{{ datetimeformat(local_dt, '%B %e, %Y') }}

 


You can hardcode it into a module or you can even paste it into the HTML of a richtext module. Note: if placed in a richtext module it'll show as code in the page editor, but the date will be rendered in preview and on send). Ex:

Page Editor (Do not type directly into the rich text, open the source code)
email-date-03.png

email-date-02.png

 

Preview

email-date.png

 

 

 

 

 

 

 

 

 

 

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
kaitlynwells
Contributeur

inserting date into email template

Résolue

Found this while looking for a way to insert a dynamic date into an automatic email, this worked perfectly - thank you! 

Rob_Gordon
Participant

inserting date into email template

Résolue

Did you manage to insert this into a template? For a 1:1 email? Or only in a Marketing email?

Thanks
Rob

0 Votes
LoraBergeron
Contributeur

inserting date into email template

Résolue

Hi,

 

I need to add a variable date as well, but I'd like to add, for example, 21 days after the current date. I'm using this to communicate an expiration date that changes with an email send from a workflow.  It can't link to the content.update information.  It needs to link to whatever date the email is sent out.  Can you help me?

Thanks in advance,

Lora B

0 Votes
kamlesh_k
Membre | Partenaire solutions Diamond
Membre | Partenaire solutions Diamond

inserting date into email template

Résolue

There is no token that you can use that inserts the date.

 

One thing you could try is a workflow to manage the email send. If you use a workflow then you can have a field with the date that triggers the email then you can use a personalization token for a date field.

 

0 Votes
fdasilva
Participant

inserting date into email template

Résolue

Can we please get on creating such an option. Competitors like Salesloft and others have had this implemented for years. 

0 Votes