r2 - 17 Apr 2008 - 09:38:21 - TWikiAdminYou are here: TWiki >  TWiki Web > DateTimePlugin


Display date and time with formatting options and localized dates.

This plugin is an extension of the TWiki variable GMTIME{"format"} (that only allows to show the current date date and time).
DateTimePlugin lets you show any date and time before or after 'now', and it will return any part of a date such as the month name.

With DateTimePlugin you can write:
In five days will be: %DATETIME{incdays="5"}% and will have a always coherent phrase.

Syntax Rules

Use %DATETIME{}% to show the current date and time in default date format (as set in configure).

For more options use: %DATETIME{"format" <optional parameters>}%


Parameter Description Example
"..." or format="..." Format of date string; see GMTIME{"format"} for formatting variables %DATETIME{"$wday"}%
date="..." Any date in one of the following formats:

Default TWiki format
    31 Dec 2001 - 23:59

TWiki format without time (defaults to 00:00)
    31 Dec 2001

Date seperated by '/', '.' or '-', time with '.' or ':'
Date and time separated by ' ', '.' and/or '-'
    2001/12/31 23:59:59
    2001/12/31 23:59
    2001-12-31 23:59
    2001-12-31 - 23:59

ISO format
ISO dates may have a timezone specifier, either Z or a signed difference in hh:mm format. For example:
The local timezone will be assumed.

Note: will not handle dates before 1970!
incdays="..." Increase the date by any number of days (may be a negative number) %DATETIME{date="31 Dec 2001" incdays="1"}%
inchours="..." Increase the date by any number of hours (may be a negative number) %DATETIME{date="31 Dec 2001 - 07:00" format="$hours" inchours="-1"}%
incminutes="..." Increase the date by any number of minutes (may be a negative number) %DATETIME{date="31 Dec 2001" format="$minutes" incminutes="15"}%
incseconds="..." Increase the date by any number of seconds (may be a negative number) %DATETIME{date="31 Dec 2001" format="$seconds" incseconds="20"}%

Formatting parameters

See GMTIME{"format"} for general date and time formatting parameters to pass to format. DateTimePlugin supports the following additional paramters:

Parameter Description Exampleup
$i_month The localized short name of the month. Ago
$i_lmonth The localized long name of the month. Julho
$lmonth The English long name of the month. July
$i_wday The summarized internationalized name of the day of the week. Qua
$i_lwday The localized long name of the day of the week. Quarta-feira
$lwday The English long name of the day of the week. Wednesday

Overview of all formatting variables

$seconds 03
$minutes 05
$hours 13
$day 03
$wday Fri
$i_wday Fri
$i_lwday Friday
$dow 5
$week 27
$month Jul
$mo 07
$i_month Jul
$i_lmonth July
$year 2020
$ye 20
$tz GMT
$iso 2020-07-03T13:05Z
$rcs 2020/07/03 13:05:03
$http Fri, 03 Jul 2020 13:05:03 GMT
$epoch 1593781503


Yesterday was %DATETIME{"$day $month $year" incdays="-1"}%

results in:

Yesterday was Thursday, 02 Jul 2020

One week from now is %DATETIME{"$wday, $day $month $year" incdays="7"}%

results in:

One week from now is Fri, 10 Jul 2020

To create time-based topics:

"Create TODO topic for tomorrow: [[ToDo$year$mo$day]] ($lwday, $day $lmonth)"

results in:

Create TODO topic for tomorrow: ToDo20200704? (Saturday, 04 July)


Due to date handling in Perl, DateTimePlugin cannot handle dates earlier than 1970.

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %DATETIMEPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Display date and time with formatting options and localized dates


Localized dates are read from configure.


Visit configure and set {DateTimePlugin}{Debug} to 1.

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip DateTimePlugin.zip in your twiki installation directory.
  • Enable the plugin in configure

Plugin Info

Plugin Author: TWiki:Main.AurelioAHeckert (2004), TWiki:Main.ArthurClemens (2008)
Plugin Version: 28 Feb 2008 (V1.0)
Change History:  
28 Feb 2008 1.0 Arthur Clemens: Major rewrite to make this plugin compatible with (and use from) TWiki::Time. Localized language strings are now read from configure.
27 Jul 2004 0.90 Aurelio A Heckert: First release
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: GPL (GNU General Public License)
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/DateTimePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/DateTimePluginDev
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
Pixeon Medical Systems
Pixeon Medical Systems - Todos os direitos reservados. 2020