LOCALTIME{…} -- display formatted date and/or time

  • The %LOCALTIME% macro is provided by the LocalTimePlugin
  • Syntax: %LOCALTIME% or %LOCALTIME{…}%
  • %LOCALTIME% expands to the current date and time using the default format, time zone, and locale
  • %LOCALTIME{…}% expands to a date and time allowing the default behavior to be overridden according to any parameters supplied
  • Supported parameters:
    Parameter: Description: Default
    "timezone" The name of the desired time zone such as "Asia/Tokyo" or "CST6CDT" or "UTC" "UTC"
    datetime="…" The date and time to display. This parameter is assumed to be in UTC unless it contains a time zone specifier.
    • Foswiki default:
      • 31 Dec 2001 - 23:59 GMT
    • ISO 8601:
      • 2001-12-31T23:59:59-0500
    • Internet (RFC 822/1123/2616/2822/5322):
      • Fri, 31 Dec 1999 23:59:59 -0500 (EST)
    • RCS:
      • 1999/12/31 23:59:59 UTC
    • Dotted decimal:
      • 1999.12.31.23.59.59 UTC

    Notes:
    • Dates must be between 1901-12-17 00:00:00 UTC and 2038-01-16 23:59:59 UTC
    • Text in ()'s is ignored as are the day of the week and comma, if present.
    • The time component is optional and defaults to midnight. If supplied, both hour and minute fields are required while seconds are optional.
    • Time zone specifiers are optional and default to UTC. When specified as an offset from UTC, they may be specified as ±HHMM or ±HH:MM
    • Time zones are part of the time specification, so you must specify a time in order to specify a time zone. If you desire a date to be interpreted locally, explicitly indicate midnight and the local time zone as in 2010-03-24 00:00 -0600
    • Years may be specified using 2 or 4 digits. When only 2 digits are supplied:
      • 00 to 38 are interpreted as the years 2000 to 2038
      • 39 to 60 are invalid and result in an error
      • 61 to 99 are interpreted as 1961 to 1999
    • Months may be specified as numbers (1-12), short names (Jan-Dec), or long names (January-December), English month names only
    • When both the month and day are specified as numbers, they are always interpreted assuming an American-style date format where the month comes before the day. (i.e. MM/DD/CCYY)
    • When only a month and day are specified, the year is assumed to be the current year if the date falls within the current or a prior month and the prior year if the date falls within a subsequent month.
    • When only a year is specified, January 1st is assumed.
    Current time
    format="…" The format specifier string defining how to display the date and/or time "$longdate"
    locale="…" The locale to use when displaying the date/time "en_US"

  • Deprecated parameters:
    Parameter: Description: Deprecated
    dateGMT="…" The same as datetime, use datetime instead Since 1.1
    fromtopic="…" The web.topic from which to get the value of the TIMEZONE variable, use the preference setting LOCALTIMEPLUGIN_TIMEZONE instead Since 1.1

  • Token: Unit: Example
    $seconds seconds 59
    $minutes minutes 59
    $hours hours 23
    $day day of month 31
    $wday day of the Week (Sun, Mon, Tue, Wed, Thu, Fri, Sat) Thu
    $dow day of the week (Sun = 0) 2
    $week number of week in year (ISO 8601) 34
    $month short name of month Dec
    $mo 2 digit month 12
    $year 4 digit year 1999
    $ye 2 digit year 99
    $tziso time zone as offset from UTC ±HHMM -0500
    $tz time zone identifier UTC
    $epoch seconds since 1970-01-01T00:00:00Z 1057159140
    $iso ISO format timestamp 1999-12-31T23:59:59-0500
    $rcs RCS format timestamp 1999/12/31 23:59:59
    $http RFC 2616 timestamp, same as $email Fri, 31 Dec 1999 23:59:59 EST
    $email RFC 822/1123 timestamp, same as $http Fri, 31 Dec 1999 23:59:59 EST
    $rfc RFC 2822/5322 timestamp Fri, 31 Dec 1999 23:59:59 -0500
    $longdate Site default date format followed by " - HH:MM" 31 Dec 1999 - 23:59
    • Tokens can be shortened to $ followed by 3 characters ($sec for $seconds)
    • The singular versions $second, $minute, and $hour are also accepted
    • format also accepts strftime format specifiers. However, since the percent sign is significant to Foswiki, the $percnt token must be used instead of an actual percent sign. For example: the default locale timestamp specifier %c would be specified as $percntc in the format string.
  • Related: DATE, DISPLAYTIME{"format"}, GMTIME{"format"}, SERVERTIME{"format"}
  • Topic revision: r3 - 02 Jun 2016, MartinDiehl
    This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
    Ideas, requests, problems regarding DAMASK? Send feedback