User Tools

Site Tools


token:ICUDateTime

ICU Date/Time Tokens

The %ICUDateTime%, %ICUDateTimePlus%, %ICUDateTimeMinus% and %ICUDateTimeFor% tokens return the a date formatted in a specific format. More details are provided in the Dates and Times article.

Fields & Format Used by These Tokens

  • %ICUDateTime%format% - the current date and time.
  • %ICUDateTimeFor%NOW()+20%format% - the specified unixtime date.
  • %ICUDateTimePlus%3+6%Hours%format% - the current time plus a specified number of the specified time units.
  • %ICUDateTimeMinus%3+6%Hours%format% - the current time minus a specified number of the specified time units.

Time Units

The available time units for %ICUDateTimePlus% and %ICUDateTimeMinus% are:

  • Seconds
  • Minutes
  • Hours
  • Days
  • Weeks
  • Months
  • Years
  • Sundays
  • Mondays
  • Tuesdays
  • Wednesdays
  • Thursdays
  • Fridays
  • Saturdays

For a weekday (v8+), if you Plus 0, it will return the next appropriate day, possibly returning the start day if that is the correct day; if you Plus 1, it will return the next appropriate day, strictly after the starting day.

For example, if today is Tuesday, September 5, 2017, you would get these results:

TokenResult
%ICUDateTimePlus%0%Tuesdays%EEE, MMM d, yyyy%
%ICUDateTimePlus%1%Tuesdays%EEE, MMM d, yyyy%
%ICUDateTimePlus%2%Tuesdays%EEE, MMM d, yyyy%
%ICUDateTimePlus%0%Wednesdays%EEE, MMM d, yyyy%
%ICUDateTimePlus%1%Wednesdays%EEE, MMM d, yyyy%
%ICUDateTimePlus%2%Wednesdays%EEE, MMM d, yyyy%
%ICUDateTimePlus%0%Mondays%EEE, MMM d, yyyy%
%ICUDateTimePlus%1%Mondays%EEE, MMM d, yyyy%
%ICUDateTimePlus%2%Mondays%EEE, MMM d, yyyy%
%ICUDateTimeMinus%0%Tuesdays%EEE, MMM d, yyyy%
%ICUDateTimeMinus%1%Tuesdays%EEE, MMM d, yyyy%
%ICUDateTimeMinus%2%Tuesdays%EEE, MMM d, yyyy%
%ICUDateTimeMinus%0%Wednesdays%EEE, MMM d, yyyy%
%ICUDateTimeMinus%1%Wednesdays%EEE, MMM d, yyyy%
%ICUDateTimeMinus%2%Wednesdays%EEE, MMM d, yyyy%
%ICUDateTimeMinus%0%Mondays%EEE, MMM d, yyyy%
%ICUDateTimeMinus%1%Mondays%EEE, MMM d, yyyy%
%ICUDateTimeMinus%2%Mondays%EEE, MMM d, yyyy%
Tue, Sep 5, 2017
Tue, Sep 12, 2017
Tue, Sep 19, 2017
Wed, Sep 6, 2017
Wed, Sep 6, 2017
Wed, Sep 13, 2017
Mon, Sep 11, 2017
Mon, Sep 11, 2017
Mon, Sep 18, 2017
Tue, Sep 5, 2017
Tue, Aug 29, 2017
Tue, Aug 22, 2017
Wed, Aug 30, 2017
Wed, Aug 30, 2017
Wed, Aug 23, 2017
Mon, Sep 4, 2017
Mon, Sep 4, 2017
Mon, Aug 28, 2017

Note how Plus 0 and Plus 1 are the same unless today is the same as the weekday. Also note that Plus 0 and Minus 0 is not the same (except when today is the same as the weekday).

Format Specification

The format is a specified with an ICU Date Time Format Specifier which allows you to produce the date in almost any format you desire.

Keep in mind that TIME is in GMT and the output of ICUDateTimeFor is in local time, so when doing this sort of thing it is best to use midday instead of midnight:

%ICUDateTimeFor% TIME(2015, 8, 23,12,0,0) %EEE, MMM d, yyyy%

which will generally work anywhere since at midday GMT, the entire world (almost) is on the same date. Otherwise, folks with negative GMT offsets (which includes all of the Americas for example) will get the wrong result.

Using Variables with These Date/Time Tokens

To use a Variable instead of a number in a token, like the ICUDateTimePlus token, just enter the Variable name without any additional %, as in:

%ICUDateTimePlus%3%Days%yyyyMMdd%
%ICUDateTimePlus%YourVariableName%Days%yyyyMMdd%

For an example, see Generate File Named Based on Day of Week [Example]

See Also


Actions

Functions

Tokens

Topics

Forum

token/ICUDateTime.txt · Last modified: 2017/09/07 00:11 by peternlewis