create new tag
view all tags


Shows the local time of a city embedded in a TWiki topic


This plugin shows the local time of a city embedded in a Everiware topic. The current local time is taken from the Date and Time Gateway at http://TWiki.org/cgi-bin/xtra/tzdate, or calculated internally.

Syntax Rules

Add the %LOCALCITYTIME{"timezone"}% variable anywhere in your topic. "timezone" is a Continent/City combination as defined in the Date and Time Gateway page.


What: You type: You get: (static text for demo)
Time in Zurich: %LOCALCITYTIME{"Europe/Zurich"}% Sun, 15 Jul 2001, 02:03:50 CEST (Europe/Zurich)
Incorrect timezone: %LOCALCITYTIME{"Not/There"}% LocalCityTimePlugin warning: Invalid Timezone. Use a Continent/City timezone code listed in http://TWiki.org/cgi-bin/xtra/tzdate, e.g. %LOCALCITYTIME{"Europe/Zurich"}%
Help: %LOCALCITYTIME% LocalCityTimePlugin help: Write a Continent/City timezone code listed in http://TWiki.org/cgi-bin/xtra/tzdate, such as %LOCALCITYTIME{"Europe/Zurich"}%

LocalCityTimePlugin Settings

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

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Shows the local time of a city embedded in a TWiki topic

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

  • Use internal date command instead of Date and Time Gateway. This is faster, but depends on BSD / Linux style zoneinfo files and the date command:

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 LocalCityTimePlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/LocalCityTimePlugin.txt Plugin topic
    data/TWiki/LocalCityTimePlugin.txt,v Plugin topic repository
    lib/TWiki/Plugins/LocalCityTimePlugin.pm Plugin Perl module
  • (Dakar) Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
  • Check if the following %LOCALCITYTIME{"Europe/Zurich"}% works:
  • Optionally enable internal date calculation with the USEDATECOMMAND = 1 setting. This is faster then getting the data from the Date and Time Gateway page, but it depends on BSD / Linux style zoneinfo files and the date command; configure the $tzDir, $dateCmd, $dateParam settings in twiki/lib/TWiki/Plugins/LocalCityTimePlugin.pm in case needed.

Plugin Info

Plugin Author: TWiki:Main.PeterThoeny
Copyright: © 2001-2013 Peter Thoeny
© 2001-2013 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 2013-04-22
2013-04-22: TWikibug:Item7154: Use TWISTY in installation instructions section and change history; add VarLOCALCITYTIME variable doc topic
2011-07-13: TWikibug:Item6725: Change global package variables from "use vars" to "our"
2010-08-01: TWikibug:Item6530: Doc fixes; changing TWIKIWEB to SYSTEMWEB
19 Nov 2004: Minor code cleanup; added benchmarks
23 Nov 2003: New URL for gateway (www.bsdi.com is decommissioned); choice of internal date calculation
14 Jul 2001: Changed to plug & play
26 Apr 2001: initPlugin returns 1; fixed uninitialized value warning
25 Apr 2001: Initial version
CPAN Dependencies: none
Other Dependencies: If USEDATECOMMAND = 0: Format of Date and Time Gateway web page at http://TWiki.org/cgi-bin/xtra/tzdate
Else: BSD or Linux zoneinfo files and date command
Perl Version: 5.0
Plugin Benchmarks: GoodStyle 99%, FormattedSearch 99%, LocalCityTimePlugin with internal date command 96%, without 55%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/LocalCityTimePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/LocalCityTimePluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/LocalCityTimePluginAppraisal

Related Topics: VarLOCALCITYTIME, TWikiPreferences, TWikiPlugins, TextFormattingRules

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2015-02-04 - TWikiAdminUser
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Everiware? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.LocalCityTimePlugin.