How to use the plugin
Using the plugin is incredibly simple. Simple include the plugin on the page you want to display a localtime on after the main jQuery plugin;
And then every string that has a CSS class of "localtime" that contains an ISO 8601 date/time string will be converted to the viewers local time;
<span class="localtime">2010-12-12 19:27:00Z</span>
will display in the viewers browser as 2010-12-12 11:27 if they are in the PST timezone, 2010-12-12 19:27 if they are in the UK, and 2010-12-12 14:27 in New York.
If you don't want to (or can't for some reason) use the CSS class named "localtime", then you can specify the name of the class you want to format with the style;
If you want two or more different styles, then simply specify them all;
When specifying the time in the HTML source of the page, the plugin expects that time to be specified in UTC. The localtime display of that UTC time is calculated using the browser. The UTC time must be specified in one of a subset of the IS0 8601 formats, specifically;
Although the HTML source of the page is limited to the format of the time, the plugin supports a wide range of date/time formats. The default format for the date/time is yyyy-MM-dd HH:mm:ss - if you want to display it in any other format, then simply call $.localtime.setFormat(timeFormat); immediately after loading the plugin, where the timeFormat contains any of the following;
Any other characters are passed as-is.
These date/time formatters are a combination of those in the SimpleDateFormat class in Java and those provided by the jQuery Global plugin. The former remain for backward compatibility, those for the latter will eventually all be implemented (see also issue 5 ).