Date parsing

From semantic-mediawiki.org
Jump to: navigation, search

Semantic extension(s): Semantic MediaWiki

Further extension(s): -/-

Keyword(s): -/-

Description:

In order to select by date in inline queries it is necessary to specify dates with 2016, 12 etc separated by '-' or '/'. The MW special words can be concatenated together as shown in the following query.

The {{CURRENTTIMESTAMP}} and {{LOCALTIMESTAMP}} will not work as the returned date/time (ie 20090101123456) is treated as an integer year.

{{#ask: [[Category:Event]] [[event_date::>{{CURRENTYEAR}}/{{CURRENTMONTH}}/{{CURRENTDAY}}]] | ?event_date | ?map_name = location | ?directions = description | format=icalendar | searchlabel=iCal }}

Or (if you have ParserFunctions installed):

{{#ask: [[Category:Event]] [[event_date::>{{#time: d.m.Y}}]]
 | ?event_date
 | ?map_name = location
 | ?directions = description
 | format=icalendar
 | searchlabel=iCal
}}

Which also can do some calculations:

{{#ask: [[Category:Event]] [[event_date::>{{#time: d.m.Y | -1 month }}]]
 | ?event_date
 | ?map_name = location
 | ?directions = description
 | format=icalendar
 | searchlabel=iCal
}}