%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
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.
Notes:
| 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" |
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 |
$sec
for $seconds
)
$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.
You want: | You type: | You get: |
---|---|---|
Current time: | %LOCALTIME% |
|
Current time in Tokyo: | %LOCALTIME{"Asia/Tokyo"}% |
|
Current time in US Central Time Zone: | %LOCALTIME{"CST6CDT"}% |
|
Current time in Internet format: | %LOCALTIME{format="$rfc"}% |
|
Current time in Paris, France: | %LOCALTIME{"Europe/Paris" locale="fr_FR" format="$rfc"}% |
|
2006-04-05T15:43:50Z in Sydney, Australia |
%LOCALTIME{"Australia/Sydney" datetime="2006-04-05T15:43:50Z"}% |
|
|
%LOCALTIME{"Australia/Sydney" datetime="Sun, 28 Mar 2010 05:58:38 -0500 (CDT)" format="$http"}% |
|
Setting | Description | Default |
---|---|---|
DATEFORMAT | The default output format specifier to use when formatting dates and/or times | $longdate |
DEBUG | Enable/disable logging of debug traces to the Foswiki Debug Log | off |
LOCALE | The default locale to use when formatting dates and/or times | en_US |
TIMEZONE | The default time zone to use when interpreting the value of the datetime parameter when no time zone is provided. |
UTC |
* Set LOCALTIMEPLUGIN_DATEFORMAT = $longdate * Set LOCALTIMEPLUGIN_DEBUG = off * Set LOCALTIMEPLUGIN_LOCALE = en_US * Set LOCALTIMEPLUGIN_TIMEZONE = UTC
configure
, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Setting | Description |
---|---|
{UseLocale} |
Enable/Disable use of locales for the site |
{Site}{Locale} |
The default locale for the site. This setting will be ignored if {UseLocale} is disabled. |
{DefaultDateFormat} |
The default date format for the site |
{Tools}{perlCmd} |
The path to the Perl interpreter if it isn't on the default path |
{Plugins}{LocalTimePlugin}{perlCmd} |
The path to the Perl interpreter if it isn't on the default path. If present, overrides the setting of {Tools}{perlCmd} |
Current time (UTC): | |
Current time (Asia/Tokyo): | |
Current time (CST6CDT): | |
2010-03-24T12:34:56Z: | |
File: | Description: |
---|---|
data/System/LocalTimePlugin.txt |
Plugin documentation topic |
data/System/VarLOCALTIME.txt |
Syntax summary for the LOCALTIME macro |
lib/Foswiki/Plugins/LocalTimePlugin.pm |
Plugin module |
lib/Foswiki/Plugins/LocalTimePlugin/Config.spec |
Config template |
Author: | TWiki:Main.NathanOllerenshaw, Foswiki:Main.SvenDowideit, & Foswiki:Main.BryanThale | ||||||||||||
Copyright: | © 2010, Foswiki Contributors | ||||||||||||
License: | GPL (GNU General Public License, Version 3) | ||||||||||||
Release: | 1.1.1 | ||||||||||||
Version: | 7117 (2010-04-07) | ||||||||||||
Home: | Foswiki:Extensions.LocalTimePlugin | ||||||||||||
Support: | Foswiki:Support.LocalTimePlugin | ||||||||||||
Dependencies: |
|
||||||||||||
Change History: | |||||||||||||
07 Apr 2010 (1.1.1): | Foswikitask:Item8853 - Remove leak of server path information in error messages and require Foswiki Plugin API v2.0+ | ||||||||||||
03 Apr 2010 (1.1): | Foswikitask:Item8805 - Correct handling of parameters and formatting tokens Foswikitask:Item8806 - Change default time zone to UTC, add datetime parameter, deprecate fromtopic and dateGMT parametersFoswikitask:Item8757 - Add support for mod_perl2 Foswikitask:Item8807 - Add support for user locale Foswikitask:Item1854 - Use published Plugin API calls |
||||||||||||
20 Feb 2009 (1.0): | port to Foswiki | ||||||||||||
05 Mar 2006 (Dakar): | SvenDowideit@WikiRing.com - updated to use registerHandler, added format= and dateGMT parameters | ||||||||||||
02 Jul 2003: | Initial version |
ExtensionClassification | Information structuring and Search |
ExtensionType | PluginPackage |
DemoUrl | http:// |
ModificationPolicy | CoordinateWithAuthor |
I | Attachment | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|
md5 | LocalTimePlugin.md5 | manage | 168 bytes | 07 Apr 2010 - 03:24 | BryanThale | |
sha1 | LocalTimePlugin.sha1 | manage | 192 bytes | 07 Apr 2010 - 03:25 | BryanThale | |
tgz | LocalTimePlugin.tgz | manage | 11 K | 07 Apr 2010 - 03:24 | BryanThale | |
zip | LocalTimePlugin.zip | manage | 14 K | 07 Apr 2010 - 03:24 | BryanThale | |
EXT | LocalTimePlugin_installer | manage | 4 K | 07 Apr 2010 - 03:24 | BryanThale |