Sandbox 2/time

#time
This parser function takes a date and/or time (in the Gregorian calendar) and formats it according to the syntax given. A date/time object can be specified; the default is the value of the magic word   – that is, the time the page was last rendered into HTML.


 *  
 *  
 *  

The list of accepted formatting codes is given in the table to the right. Any character in the formatting string that is not recognised is passed through unaltered; this applies also to blank spaces (the system does not need them for interpreting the codes). There are also two ways to escape characters within the formatting string: In addition, the digraph xx is interpreted as a single literal "x".
 * 1) A backslash followed by a formatting character is interpreted as a single literal character
 * 2) Characters enclosed in double quotes are considered literal characters, and the quotes are removed.


 *   → 
 *   → 
 *   → 
 *  </tt> → 
 *  </tt> → 

The date/time object</tt> can be in any format accepted by PHP's strtotime function. Both absolute (eg 20 December 2000</tt>) and relative (eg +20 hours</tt>) times are accepted.

 </tt> → '''

 </tt> → '''

 </tt> → '''

The language code in ISO 639-3 (?) allows the string to be displayed in the chosen language  </tt> → '''

 </tt> → '''

 </tt> → '''

If you've calculated a Unix timestamp, you may use it in date calculations by pre-pending an @</tt> symbol.

 </tt> → '''

 </tt> → '''

Full or partial absolute dates can be specified; the function will "fill in" parts of the date that are not specified using the current values:


 *  </tt> → '''

With MediaWiki r86805 - Code Review, a four-digit number is always interpreted as a year, never as hours and minutes:

 </tt> → '''

A six-digit number is interpreted as hours, minutes and seconds if possible, but otherwise as an error (not, for instance, a year and month):

<tt> </tt> → ''' Input is treated as a time rather than a year+month code.

<tt> </tt> → ''' Although 19:60:09 is not a valid time, 196009 is not interpreted as September 1960.

The function performs a certain amount of date mathematics:


 * <tt> </tt> → '''
 * <tt> </tt> → '''
 * <tt> </tt> → '''
 * <tt> </tt> → '''
 * <tt> </tt> → '''

The total length of the format strings of the calls of  is limited to 6000 characters.