Skip to main content
Question

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


  • Novice
  • 10 replies

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!

2 replies

Felix
  • Novice
  • 211 replies
  • January 14, 2024

Great way to solve this! Maybe you wanna post this in "Learn & Share" so it's easier to find it 😁

https://community.customer.io/learn-share-31

 

Best, 

Felix


  • Author
  • Novice
  • 10 replies
  • January 14, 2024

Ugh, I think I posted it twice here :) Not sure if I can delete one of them


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings