There is a smart field to insert the date and time now in your company's timezone:
{{ datetime_now }}
You can change it to any format you want by doing:
{{ datetime_now|date:"Y-m-d H:i:s" }}
This would print:
2024-05-13 15:38:26
If you want to print it in different timezones, have a look here.
The options are:
Category | Format String | Description | Example |
Hours |
| Hour, 12-hour format without leading zeros | '1' to '12' |
|
| Hour, 24-hour format without leading zeros | '0' to '23' |
|
| Hour, 12-hour format | '01' to '12' |
|
| Hour, 24-hour format | '00' to '23' |
Minutes |
| Minutes | '00' to '59' |
Seconds |
| Seconds, 2 digits with leading zeros | '00' to '59' |
Period |
| 'a.m.' or 'p.m.' | 'a.m.', 'p.m.' |
|
| 'AM' or 'PM' | 'AM', 'PM' |
Days |
| Day of the month, 2 digits with leading zeros | '01' to '31' |
|
| Day of the month without leading zeros | '1' to '31' |
|
| Day of the week, textual, 3 letters | 'Fri' |
|
| Day of the week, textual, long | 'Friday' |
|
| ISO-8601 numeric representation of the day of the week | '1' (Monday) to '7' (Sunday) |
|
| Day of the week, numeric | '0' (Sunday) to '6' (Saturday) |
|
| Day of the year, starting from '0' | '0' to '365' |
Months |
| Month; 2 digits with leading zeros | '01' to '12' |
|
| Month without leading zeros | '1' to '12' |
|
| Month, textual, 3 letters | 'Jan' |
|
| Month, textual, 3 letters, lowercase | 'jan' |
|
| Month, textual, long | 'January' |
Years |
| Year, 2 digits | '99', '23' |
|
| Year, 4 digits | '1999', '2023' |
|
| Boolean for whether it is a leap year | '1' if it is, '0' otherwise |
Weeks |
| ISO-8601 week number of year, weeks starting on Monday | '42' |
Time Zones |
| Difference to Greenwich time (GMT) in hours | '+0200' |
|
| Difference to Greenwich time (GMT) with colon | '+02:00' |
|
| Time zone of this machine | 'EST', 'MDT' |
|
| Time zone offset in seconds | '-43200' to '50400' |
Various |
| Time, in 12-hour hours and minutes, with minutes left off if they're zero | '1', '1:30' |
|
| Time, in 12-hour hours and minutes, with 'a.m.'/'p.m.' | '1 a.m.', '1:30 p.m.' |
|
| English ordinal suffix for the day of the month, 2 characters | 'st', 'nd', 'rd', 'th' |
|
| Number of days in the given month | '28' to '31' |