How to print the current date and time?

This article is going to teach you how to print the current date and time in your report. You could simply use the below syntax.

  <p>{{ "now" | date: "%Y-%m-%d %H:%M" }}</p>

And the result will be this one.

current_date_and_time.png

If you would like to set a specific time zone, then you could follow the example below.

{% assign currentDate = now | date: "%s" | timezone: "+1" | date: "%Y-%m-%d %H:%M" %}

Video demonstration

Was this article helpful? Yes  No
126 from 159 found this helpful