Tip: Adding days to a current date (for email activation/deactivation/deletion or trial)

  • 15 January 2024
  • 0 replies
  • 24 views

Userlevel 1

Just wanted to share a quick way to calculate a future date: “today’s date” (the date the email is being sent) + X days (1, 3,7,14,30,60,90,120 days):
 

{% assign today = "now" | date: "%s" %}
{% assign future_date = today | plus: 2592000 | date: "%s" %}
{{ future_date | date: "%B %-d, %Y" }}

 

Change the number after “plus:” to change the days (the value is in seconds):

  • 1 day: 86400
  • 3 days: 259200
  • 7 days: 604800
  • 14 days: 1209600
  • 30 days: 2592000
  • 60 days: 5184000
  • 90 days: 7776000
  • 120 days: 10368000

 

For example, the email would look like this:

Dear {{customer.given_name}},

We hope this message finds you well. Our records indicate that your [Company Name] account ({{customer.email}}) has been inactive for some time. We value your participation in our community and would like to remind you of the upcoming deactivation of your account.


Deactivation Date: {% assign today = "now" | date: "%s" %} {% assign thirty_days_later = today | plus: 2592000 | date: "%s" %}{{ thirty_days_later | date: "%B %-d, %Y" }}

 

Result would look like this:

Deactivation Date:  February 13, 2024

 

Hope this helps!


0 replies

Be the first to reply!

Reply