Extension:When

The #when parser-function is used to add time information to articles. Just add a single parameter which can be arbitrarily formatted time information, for example:
 *   - best to do dates backwards like this otherwise it tries to use some weird American format
 *  
 *   - current year is used here since not specified

The function expands to a set of category links to categorise the article into year, month, day-of-month, full-weekday-name and time (24 hour HH:MM:SS format). Articles exhibiting time can then be matched with a DPL query, for example:
 *  

The parser function which adds this is very simple consisting of the following code in the LocalSettings.php file.

<? $wgExtensionFunctions[]       = 'wfSetupWhen'; $wgHooks['LanguageGetMagic'][] = 'wfWhenLanguageGetMagic';

function wfSetupWhen { global $wgParser; $wgParser->setFunctionHook('when','wfExpandWhen'); return true; }

function wfExpandWhen(&$parser,$when) { $time = strtotime($when); $cats = ''; foreach(array('T','A','d','B','Y') as $f) $cats .= ''; return $cats; }

function wfWhenLanguageGetMagic(&$magicWords,$langCode = 0) { $magicWords['when'] = array(0,'when'); return true; } ?>