Tutorial:Personalize signature

From Lê Duy Quang's personal wiki
Jump to: navigation, search

Normally, you can change your signature by going to your Preferences page. But sometimes you will find editing in such a single-line textbox is limiting and you want to expand it, or you can't customize your time format to your very own. Luckily, there is another way to highly personalize your signature.

Creating your signature[edit]

The first step is to create your page containing your desired signature. Just create a normal page in your userspace (e.g. User:YourUsername/signature) and type in whatever you want the signature to be. Then save the page.

Customizing your timestamp[edit]

If you find the provided timestamp format doesn't suit your eyes, you can make it your own way.

How it works[edit]

When you type ~~~~, that will be replaced to your signature in your preferences, plus the current timestamp. In this tutorial, we will "mimic" that mechanic by using MediaWiki's substitution feature.

When our custom signature is inserted, it will be also replaced with our signature and the timestamp, but we have full control on how it will be displayed.

Creating the timestamp[edit]

To insert the current time, you can just type it in normally in your signature, using {{{{{|safesubst:}}}#time:x}}, where x is one of the following:

Code Description

Current output
(Purge this page's cache to update.)

Y 4-digit year. 2019
y 2-digit year. 19
L 1 if it's a leap year, 0 if not. 0
o[note 1]

ISO-8601 year of the specified week.[note 2]

2019[note 3]
  1. Requires PHP 5.1.0 and newer and rev:45208.
  2. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead.
  3. Will output literal o if note 1 not fulfilled.
n Month index, not zero-padded. 5
m Month index, zero-padded. 05
M An abbreviation of the month name, in the site language. May
F The full month name in the site language. May

Output the full month name in the genitive form for site languages that distinguish between genitive and nominative forms. This option is useful for many Slavic languages like Polish, Russian, Belarusian, Czech, Slovak, Slovene, Ukrainian, etc.

For Polish:
{{#time:F Y|June 2010|pl}} → czerwiec 2010
{{#time:d xg Y|20 June 2010|pl}} → 20 czerwca 2010
Day of the month or the year
j Day of the month, not zero-padded. 21
d Day of the month, zero-padded. 21
z Day of the year (January 1 = 0).
Note: To get the ISO day of the year add 1.
Week and day of the week
W ISO 8601 week number, zero-padded. 21
N ISO 8601 day of the week (Monday = 1, Sunday = 7). 2
w Number of the day of the week (Sunday = 0, Saturday = 6). 2
D An abbreviation for the day of the week. Rarely internationalized. Tue
l The full weekday name. Rarely internationalized. Tuesday
a "am" during the morning (00:00:00 → 11:59:59), "pm" otherwise (12:00:00 → 23:59:59). pm
A Uppercase version of a above. PM
g Hour in 12-hour format, not zero-padded. 2
h Hour in 12-hour format, zero-padded. 02
G Hour in 24-hour format, not zero-padded. 14
H Hour in 24-hour format, zero-padded. 14
Minutes and seconds
i Minutes past the hour, zero-padded. 54
s Seconds past the minute, zero-padded. 59
U Unix time. Seconds since January 1 1970 00:00:00 GMT. 1558450499
Timezone (as of 1.22wmf2)
e Timezone identifier. UTC
I Whether or not the date is in daylight savings time. 0
O Difference to Greenwich time (GMT) +0000
P Difference to Greenwich time (GMT), with colon +00:00
T Timezone abbreviation. UTC
Z Timezone offset in seconds. 0
t Number of days in the current month. 31
c iso8601>Y-m-d"T"H:i:s+00:00</>. 2019-05-21T14:54:59+00:00
r RFC 5322 formatted date, equivalent to <tvar|rfc5322>D, j M Y H:i:s +0000</>, with weekday name and month name not internationalized. Tue, 21 May 2019 14:54:59 +0000
Non-Gregorian calendars
xmj Day of the month. 16
xmF Full month name. Ramadan
xmn Month index. 9
xmY Full year. 1440
Iranian (Jalaly)
xit Number of days in the month. 31
xiz Day of the year. 61
xij Day of the month. 31
xiF Full month name. Ordibehesht
xin Month index. 2
xiY Full year. 1398
xiy 2-digit year. 98
xjj Day of the month. 16
xjF Full month name. Iyar
xjt Number of days in month. 29
xjx Genitive form of the month name. Iyar
xjn Month number. 8
xjY Full year. 5779
Thai solar
xkY Full year in Thai solar calendar.
Note: For years before 1941 the dates in Jan-Mar range are not calculated properly.
Minguo/Juche year
xoY Full year. 108
Japanese nengo
xtY Full year. 平成31
xn Format the next numeric code as a raw ASCII number. time>{{#time:H, xnH}}</> produces <tvar|hindi>०६, 06</>.
xN Like xn, but as a toggled flag, which endures until the end of the string or until the next appearance of xN in the string.
xr Format the next number as a roman numeral. Only works for numbers up to 10,000
(upto 3,000 in pre MediaWiki 1.20).
{{#time:xrY}} → MMXIX
xh Format the next number as a Hebrew numeral. {{#time:xhY}} → ב'י"ט


{{{{{|safesubst:}}}#time:G}}h{{{{{|safesubst:}}}#ifeq:{{#time:s}}|00|{{#ifeq:{{#time:i}}|00||{{{{{|safesubst:}}}#time:i}}}}|{{{{{|safesubst:}}}#time:i}}:{{{{{|safesubst:}}}#time:s}}}} | {{{{{|safesubst:}}}CURRENTDAY}}/{{{{{|safesubst:}}}CURRENTMONTH1}}/{{{{{|safesubst:}}}CURRENTYEAR}} (UTC)

→ 14h54:59 | 21/5/2019 (UTC)

Start using your signature[edit]

In your Preferences page, change your signature to {{subst:y}} where y is the page containing your signature.

Your new signature should now be ready to be used. If your signature contains customized timestamp, sign by typing ~~~. If it doesn't, type ~~~~.