Skip to main content

Hi There,

 

I need to put an expiration date in a flow template, it show the current date (of email sent to customer) and the expiration date will be 7 days from current date.

 

Ideally it would be the D d M Y format but if this isn’t possible anything else would do.

 

I’ve check Django resources, however have had no luck at getting the date to show correctly.

 

Any help would be greatly appreciated. Thanks, Reece

@Reece Stevenson 

It is possible, but unfortunately not in the D-M-Y format for the +7 days.

 

Today: {% today '%Y-%m-%d' as today %} {{ today }}

7 Days Later: {% today '%Y-%m-%d' as today %} {{ today|days_later:7 }}

 

Note the date needs to be in the format '%Y-%m-%d' OR '%Y-%m-%dT%H:%M:%S' OR '%m-%d-%Y' for the +7 days to work.

 

Hope this helps!


Great thanks for the help, Joseph!


Hi @retention,

This is still the only option to go with date with time using days_later?
%Y-%m-%dT%H:%M:%S - because wit that structure its not very nice to show in newsletter :)

 

 


@Jakub ,

I don’t know if the formats above are still the only option, but I have been able to display a more friendly version of the date with this code:

{% today '%Y-%m-%d' as today %} {{ today|days_later:30|format_date_string|date:'F j, Y' }}

This gives me:

January 25, 2025

I updated the date format, based on Django documentation:

{% today '%Y-%m-%dT%H:%M:%S' as today %} {{ today|days_later:30|format_date_string|date:'F j, Y g:i A' }}

and received the output of:

January 25, 2025 1:17 PM

Hope this helps!


Reply