date_time2Add my vote for this tag create new tag
, view all tags


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 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.

Date and time are displayed in GMT because of the way {DisplayTimeValues} configuration parameter is set. There is no way to specify a time zone in which date and time are displayed.

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:

In formats other than ISO, GMT time zone is always assumed.

Timestamp (seconds from the epoch)

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"}%
timezone="..." Specify the time zone in which the result is displayed. Please note that this parameter affects only display. It doesn't affect how the date parameter value is evaluated. As of July 2015, this papameter requires TWiki core downloaded from http://svn.twiki.org to work %DATETIME{"$hour:$min $tz" timezone="America/New_York"}%

Formatting parameters

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

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

Overview of all formatting variables


$seconds $seconds
$minutes $minutes
$hours $hours
$day $day
$wday $wday
$i_wday $i_wday
$i_lwday $i_lwday
$dow $dow
$week $week
$month $month
$mo $mo
$i_month $i_month
$i_lmonth $i_lmonth
$year $year
$ye $ye
$tz $tz
$iso $iso
$rcs $rcs
$http $http
$epoch $epoch


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

results in:

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

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

results in:

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

To create time-based topics:

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

results in:

%DATETIME{ "Create TODO topic for tomorrow: ToDo$year$mo$day ($lwday, $day $lmonth)" incdays="1" }%


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


Localized dates are read from configure.

Plugin Installation Instructions

Note: You do not need to install anything on your 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. Content:
    File: Description:
    lib/TWiki/Plugins/DateTimePlugin.pm Plugin Perl module
    data/TWiki/DateTimePlugin.txt Plugin topic
    data/TWiki/VarDATETIME.txt Variable documentation topic
  • Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.

  • Debugging: Visit configure and set {DateTimePlugin}{Debug} to 1.

Plugin Info

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

Plugin Author: TWiki:Main.AurelioAHeckert, TWiki:Main.ArthurClemens
Copyright: © 2004 TWiki:Main.AurelioAHeckert
© 2008 TWiki:Main.ArthurClemens
© 2008-2016 TWiki:Main.PeterThoeny
© 2004-2016 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 2016-04-25
2016-04-25: TWikibug:Item7703: Small tweak in configure setting to avoid horizontal scrolling that affects all other extensions; switch to GPL v3 from v2 -- TWiki:Main.PeterThoeny
2015-07-14: TWikibug:Item7677: DATETIME{...} now takes the timezone parameter -- TWiki:Main.HideyoImazu
2015-05-18: TWikibug:Item7655: DATETIME{$epoch} does not take inc* into account -- TWiki:Main.HideyoImazu
2013-03-27: TWikibug:Item7473: DATETIME{...} showing time in the local time zone regardless of {DisplayTimeValues} -- TWiki:Main.HideyoImazu
2013-04-22: TWikibug:Item7123: Add twisty to installation instructions and history -- TWiki:Main.PeterThoeny
2013-04-22: TWikibug:Item7151: Change CALC to CALCULATE in DATETIME related links -- TWiki:Main.PeterThoeny
2012-11-12: TWikibug:Item7020: Categorize TWiki Variable -- TWiki:Main.PeterThoeny
2012-10-05: TWikibug:Item6947: Support unix timestamp for the input -- TWiki:Main.MahiroAndo
2011-05-14: TWikibug:Item6701: Small fix in Config.spec -- TWiki:Main.PeterThoeny
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
TWiki:Plugins.Benchmark: GoodStyle nn%, FormattedSearch nn%, DateTimePlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/DateTimePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/DateTimePluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/DateTimePluginAppraisal

Related Topics: VarDATETIME, TWikiPlugins, DeveloperDocumentationCategory, UserDocumentationCategory

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 DateTimePlugin.md5 r13 r12 r11 r10 r9 manage 0.2 K 2016-04-26 - 06:10 PeterThoeny  
Compressed Zip archivetgz DateTimePlugin.tgz r13 r12 r11 r10 r9 manage 8.0 K 2016-04-26 - 06:10 PeterThoeny  
Compressed Zip archivezip DateTimePlugin.zip r17 r16 r15 r14 r13 manage 10.2 K 2016-04-26 - 06:10 PeterThoeny  
Unknown file formatEXT DateTimePlugin_installer r7 r6 r5 r4 r3 manage 3.5 K 2016-04-26 - 06:10 PeterThoeny  
Edit | Attach | Watch | Print version | History: r23 < r22 < r21 < r20 < r19 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r23 - 2016-04-26 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.