%META:TOPICINFO{author="TWikiContributor" date="1292130683" format="1.1" version="1"}%
---+!! <nop>%TOPIC%
<!--
   Contributions to this TWiki plugin are appreciated. Please update the plugin page at
   http://twiki.org/cgi-bin/view/Plugins/LocalTimePlugin or provide feedback at
   http://twiki.org/cgi-bin/view/Plugins/LocalTimePluginDev.
   If you are a TWiki contributor please update the plugin in the SVN repository.
-->
<sticky><div style="float:right; background-color:#EBEEF0; margin:0 0 20px 20px; padding: 0 10px 0 10px;">
%TOC{title="Page contents"}%
</div></sticky>
%SHORTDESCRIPTION%

---++ Introduction

This plugin is an alternative to the TWiki:Plugins.LocalCityTimePlugin and can be used for a systems diary.

---++ Syntax Rules

Add a %<nop>LOCALTIME% tag to your text to show the current time. You can specify the location or timezone such as "Asia/Tokyo" or "GMT" with %<nop>LOCALTIME{location}%, where _location_ is a location mentioned at http://twiki.org/cgi-bin/xtra/tzdate, or a timezone code such as "JST".
   * see http://www.twinsun.com/tz/tz-link.htm for more information

   * The =unnamed=, or =DEFAULT= parameter is the timezone to output
   * =dateGMT= must be a datetime string that TWiki can parse (see Time::TWiki::parseTime), but assumes GMT
      * 31 Dec 2001 - 23:59
      * 2001/12/31 23:59:59
      * 2001.12.31.23.59.59
      * 2001/12/31 23:59
      * 2001.12.31.23.59
      * 2001-12-31T23:59:59Z
      * 2001-12-31T23:59:59+01:00
      * 2001-12-31T23:59Z
      * 2001-12-31T23:59+01:00
   * =format= is the same as for the format specifier in http://t42p/cgi-bin/DEVELOP/bin/view/TWiki/TWikiVariables#VarGMTIME
   * fromtopic="web.topic" - the plugin tries to use the timezone set in the variable TIMEZONE on the topic selected

---++ Examples

| | you type | if installed you get |
| Time in Tokyo now | %<nop>LOCALTIME{Asia/Tokyo}% | %LOCALTIME{Asia/Tokyo}% |
| Time in London now | %<nop>LOCALTIME{Europe/London}% | %LOCALTIME{Europe/London}% |
| Time in your TIMEZONE (if you've set the TIMEZONE VAR) now | %<nop>LOCALTIME{fromtopic="$percntWIKIUSERNAME$percnt"}% | %LOCALTIME{fromtopic="$percntWIKIUSERNAME$percnt"}% |
| 05 Apr 2006, 15:43:50 GMT in Sydney/Australia | %<nop>LOCALTIME{"Australia/Sydney" dateGMT="05 Apr 2006 - 15:43:50"}% | %LOCALTIME{"Australia/Sydney" dateGMT="05 Apr 2006 - 15:43:50"}% |
| 05 Apr 2006, 15:43:50 GMT in Sydney/Australia (format as iso) | %<nop>LOCALTIME{"Australia/Sydney" dateGMT="05 Apr 2006 - 15:43:50" format="iso"}% | %LOCALTIME{"Australia/Sydney" dateGMT="05 Apr 2006 - 15:43:50" format="iso"}% |

This plugin can be used in combination with the CalendarPlugin, to get a localtime version of your appointments.

A member of your %USERSWEB%.TWikiAdminGroup may need to add this plugin to the {PluginsOrder} configure setting to make sure it evaluates before the CalendarPlugin.

to add a !TWikiIrcMeeting add a line like
<pre>
   * %<nop>LOCALTIME{"Australia/Sydney" dateGMT="6 Mar 2006 - 15:39" format="$day $month"}% - TWikiIrcMeeting
</pre>

you can even define a USER variable on your !UserTopic, that sets a !TimeZone variable, and replace the hard-coded !Timezone with that variable.

---++ <nop>%TOPIC% Global Settings

   * One line description:
      * Set SHORTDESCRIPTION = Show the current date and time of a particular city/timezone.

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

   * Defaults:
      * Set TIMEZONE = America/Los_Angeles

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

   * Install the Date::Handler package from CPAN:
      * perl -MCPAN -e 'install Date::Handler'
   * Download the ZIP file from the repository on twiki.org (see below)
   * Unzip ==%TOPIC%.zip== in your twiki installation directory. Content:
     | *File:* | *Description:* |
     | ==data/TWiki/%TOPIC%.txt== | Plugin topic |
     | ==lib/TWiki/Plugins/%TOPIC%.pm== | Plugin Perl module |
   * Visit =configure= in your TWiki installation, and enable the plugin in the {Plugins} section.
   * Test if the installation was successful:
      * %LOCALTIME%

---++ Plugin Info

|  Plugin Author: | TWiki:Main.NathanOllerenshaw & TWiki:Main.SvenDowideit |
|  Copyright: | &copy; 2003 TWiki:Main.NathanOllerenshaw <br /> &copy; 2006 TWiki:Main.SvenDowideit <br /> &copy; 2006-2010 TWiki:TWiki.TWikiContributor |
|  Plugin Version: | 2010-12-11 (V2.1) |
|  Change History: | <!-- versions below in reverse order -->&nbsp; |
|  2010-12-11: | TWikibug:Item6530: Doc improvements, changing TWIKIWEB to SYSTEMWEB -- TWiki:Main.PeterThoeny |
|  2006-03-05: | Updated to use TWiki04 registerHandler, added format= and dateGMT parameters -- TWiki:Main.SvenDowideit |
|  2003-07-02: | Initial version -- TWiki:Main.NathanOllerenshaw |
|  CPAN Dependencies: | Date::Handler |
|  Other Dependencies: | none |
|  Perl Version: | 5.005 |
|  Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC% |
|  Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev |

__Related Topics:__ %SYSTEMWEB%.TWikiPreferences, %SYSTEMWEB%.TWikiPlugins
