Help:Date parsing

From semantic-mediawiki.org
(Redirected from Help:Date parsing)
Semantic extension(s): Semantic MediaWiki
Further extension(s): ParserFunctions
Keyword(s): dates

Description:

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

The 20241226220728 and 20241226230728 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 extension "ParserFunctions" (MediaWiki.org) installed):

{{#ask:
 [[Category:Event]]
 [[Event date::>{{#time: d.m.Y}}]]
 |?Event date
 |?Map name=location
 |?Directions=description
 |format=icalendar
 |searchlabel=iCal
}}

Which also allows you to 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
}}