Dynamic date and time tags
This article describes all dynamic tags that expand to the current date and time. Different tags expand to the current date and time in different formats and time zones or to components of the current calendar date and wall clock time.
These tags can be used everywhere where dynamic tags are allowed, including actions and search expressions.
Tip: In addition to the dynamic date tags below, you may be interested in learning how to search for numbers and time/date values.
The {{now}}
tag and all tags in the now
namespace expand to some form or component of the current local date and time. The local time zone depends on the site's configuration. Tags that expand to ISO 8601 format do not include a time zone designator, which indicates that they are to be interpreted as the local date and time.
The local time zone is determined by the Windows time zone settings on the FotoWeb server. FotoWeb will also respect rules for daylight-saving time. Administrators are advised to set the time zone on the FotoWeb server to whatever is intended to be local time in FotoWeb. For example, suppose a FotoWeb site is used by an organization with employees mostly located in Germany or working with content that mostly originates from or is to be published in Germany. In that case, it may be convenient to set the local time zone to Berlin (UTC+1) and enable an automatic transition between daylight-savings time and winter time.
The {{utcnow}}
tag and all tags in the utcnow
namespace expand to some form or component of the current universal date and time (UTC). Tags that expand to ISO 8601 format include aZ
time zone designator. For example:
Tag |
Expands to |
---|---|
{{now}} |
2023-05-17T13:30:45 |
{{utcnow}} |
2023-05-17T12:30:45Z |
assuming that the local time zone is 1 hour ahead of UTC.
Note: Time zone also matters for tags that expand to only the date or only a component of the date. For example, {{utcnow.year}}
may expand to 2023
at 11:50 p.m. on December 31st, 2023, whereas {{now.year}}
may expand to 2024
at the same time, if the local time zone is 1 hour ahead of UTC.
Date and time tags
Tag |
Format |
Remarks |
Example |
---|---|---|---|
|
YYYY-MM-DDThh:mm:ss |
Expands to the current date and time in ISO 8601 format. The UTC tags produce a time zone designator. |
|
|
YYYY-MM-DD |
Expands to the current date in ISO 8601 format. The UTC tags produce a time zone designator. |
|
|
YYYYMMDD |
Expands to the current date in compact ISO 8601 format. Never produces a time zone designator, not even in the UTC variant. |
20230527 |
|
hh:mm:ss |
Expands to the current time of day in ISO 8601 format. Never produces a time zone designator, not even in the UTC variant. |
12:45:30 |
|
YYYY |
Expands to the current year. | 2014 |
|
MM |
Expands to the number of the current month of the year with at least 2 digits. |
|
|
DD |
Expands to the current day of the month with at least 2 digits. |
|
|
hh |
Expands to the current hour of the day with at least 2 digits. If no If given, the |
The phrase
may be expanded to: "02:15 PM" |
|
mm |
Expands to the current minute of the hour with at least 2 digits. | 03 |
|
ss |
Expands to the current second of the minute with at least 2 digits. | 04 |
|
AM|PM |
Expands to the current meridiem. If the current time of day is before noon, then this tag expands to Can be used with |
|
Time duration syntax
Time durations in offsets must be given in ISO 8601 format, which looks as follows:
P[nY][nM][nW][nD][T[nH][nM][nS]]
where n
is a placeholder for an integer number and a capital letter that either specifies the unit of the number that follows it or acts as a separator:
Unit |
Description |
Examples |
|
---|---|---|---|
P |
Every duration must begin with a capital P (to distinguish it from something else, e.g., a number) |
The offset +P12Y
is a time duration, because it begins with a capital P. The offset +12 is not a time duration. |
|
Y |
Years | The duration P5Y means "5 years". |
|
M (before T ) |
Months | The duration P7M means "7 months". |
|
W |
Weeks | The duration P3W means "3 weeks". |
|
D |
Days | The duration P4D means "4 days". |
|
T |
Separates date and time. All time components must be given after the capital T. If no time components are given, then the capital T can be omitted. |
The duration P5Y3M does not need a capital T, because it only contains date components. It means "5 years and 3 months". The duration PT5M needs a capital T to indicate that it means "5 minutes" and not "5 months". The duration P5DT6H combines both date and time components and means "5 days and 6 hours". |
|
H |
Hours | The duration PT6H means "6 hours". |
|
M (after T ) |
Minutes | The duration PT20M means "20 minutes". |
|
S |
Seconds. Unlike all other components, seconds can be given as a floating-point number, e.g., |
The duration The duration |
Components must be given in the correct order. For example, the following duration is invalid:
P5D3W
The following valid duration means "3 weeks and 5 days":
P3W5D
Offsets
All date/time tags support time durations as offsets. For example, the tag
{{now+P1DT6H}}
expands to the current local time plus 1 day plus 6 hours in ISO 8601 format. All tags that expand to single numbers also support numeric offsets. For example,
{{now.month-5}}
expands to the number of the current month minus 5. If the current month is, for example, January (1), then the result is -4
.
If you want the number of the month to wrap around and thus remain a valid month number, then use a date/time offset:
{{now.month-P5M}}
This expands to 08
(August) if the current month is January (1).
Example: Specifying a range
A range can be specified as such:
mt:{{now-PT6H}} TO {{now}}
In this example, we search for files with a modified time interval starting 6 hours before now and ending now. Note how the predicate (mt:) is implied in the second time specifier and does not have to be repeated.