Wikibooks:Comments in Local Time

Comments in Local Time is a gadget that converts timestamps, including those that appear in signatures, from Coordinated Universal Time to your local time. The code was imported from User:Gary King/comments in local time.js to MediaWiki:Gadget-CommentsInLocalTime.js.

Installation


To enable this gadget, go to your preferences, click on the "Gadgets" tab, and checkmark the box labeled "Change UTC-based time and date stamps, such as those used in talk page comments, to be relative to local time."

Examples
This:

00:00 1 January 2009 (UTC)

Appears as

31 December 2008, Wednesday (2 days ago), 7:00 pm (UTC-5)

The date returned is shown in your local time, based on your computer's timezone settings. Dates that are either today, yesterday, or tomorrow are shown with a relative dates, such as

Today, 0:00 am (UTC-5)

Custom settings
To change the default settings, copy the above code to your vector.js (or common.js) page and change the values after the equals sign. The settings are explained in greater detail below.


 * dateDifference
 * Shows the difference in terms of days, months, and years from the timestamp and today's date.
 * Options: to show the difference between the timestamp and today's date, and  to hide the difference


 * dateFormat
 * Changes the date's format.
 * Options: for "1 January 2009",  for "January 1, 2009", and  for "2009-01-01"


 * timeFirst
 * Changes the order in which the time and date appears in timestamps.
 * Options: for the time to appear before the date, and  for the date to appear before the time


 * twentyFourHours
 * Uses a 24-hour clock instead of the default 12-hour clock.
 * Options: for a 12-hour clock, and  for a 24-hour clock

Style
To change the timestamp's style, add the code below to your vector.css page and modify it using Cascading Style Sheets. For example, to change the timestamp's size, increase or decrease the percentage in the code accordingly, such as to.