Skip to main content

 

Documentation & User Guides | FotoWare

Date and Time Tags in FotoWeb

 

This article describes all Dynamic tags which 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.

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 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-savings 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, if 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, then it may be convenient to set the local time zone to Berlin (UTC+1) and enable 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 aZtime zone designator. For example:

Tag

Expands to

{{now}} 2016-05-17T13:30:45
{{utcnow}} 2016-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 2015 at 11:50 p.m. on December 31st, 2015, whereas {{now.year}} may expand to 2016 at the same time, if the local time zone is 1 hour ahead of UTC.

Date and Time Tags

Tag

Format

Remarks

Example

{{now}}

{{utcnow}}

{{now.isodatetime}}

{{utcnow.isodatetime}}

YYYY-MM-DDThh:mm:ss

Expands to the current date and time in ISO 8601 format.

The UTC tags produce a time zone designator.

2016-05-17T13:30:45

2016-05-17T13:30:45Z

{{now.isodate}}

{{utcnow.isodate}}

YYYY-MM-DD

Expands to the current date in ISO 8601 format.

The UTC tags produce a time zone designator.

2016-05-17

2016-05-17Z

{{now.date}}

{{utcnow.date}}

YYYYMMDD

Expands to the current date in compact ISO 8601 format.

Never produces a time zone designator, not even in the UTC variant.

20160527

{{now.time}}

{{utcnow.time}}

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

{{now.year}}

{{utcnow.year}}

YYYY Expands to the current year. 2014

{{now.month}}

{{utcnow.month}}

MM Expands to the number of the current month of the year with at least 2 digits.

05

{{now.day}}

{{utcnow.day}}

DD Expands to the current day of the month with at least 2 digits. 07

{{now.hour}}

{{utcnow.hour}}

{{now.hour:FORMAT}}

{{utcnow.hour:FORMAT}}

hh

Expands to the current hour of the day with at least 2 digits.

If no FORMAT parameter is given, then the number of the hour is in 24-hour format (e.g., from 00 for midnight to 23 for 11 p.m.)

If given, the FORMAT parameter must be either 12 or 24, where 12 means that the number of the hour is in 12-hour format with 12 being used for both midnight and noon. This can be used together with the {{now.meridiem}} or {{utcnow.meridiem}} tag to produce time representations such as 01:25 PM. if FORMAT is 24, then the number of the hour is in 24-hour format, as described above.

The phrase

"{{now.hour:12}}:{{now.minute}} {{now.meridiem}}"

may be expanded to:

"02:15 PM"

{{now.min}}

{{now.minute}}

{{utcnow.min}}

{{utcnow.minute}}

mm Expands to the current minute of the hour with at least 2 digits. 03

{{now.sec}}

{{now.second}}

{{utcnow.sec}}

{{utcnow.second}}

ss Expands to the current second of the minute with at least 2 digits. 04

{{now.mer}}

{{now.meridiem}}

{{utcnow.mer}}

{{utcnow.meridiem}}

AM|PM

Expands to the current meridiem.

If the current time of day is before noon, then this tag expands to AM. Otherwise, this tag expands to PM.

Can be used with {{now.hour:12}} or {{utcnow.hour:12}} to produce as 12-hour time representation.

AM

PM

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 letters either specifies the unit of the number that follows it or act as 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

+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., 123.456. However, integer numbers are also accepted.

The duration PT12S means "12 seconds".

The duration PT12.5S means "12.5 seconds".

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 to be repeated.