date_sub
The date function used to subtract some period of duration from a date or datetime value. Takes three arguments, the original date, a number of units of duration to subtract, and the unit of duration (one of "year", "decade", "century", "quarter", "month", "week", "day", "hour", "minute", "second", or "millisecond").
Returns: date
Table 1.
Parameter | Type |
---|---|
dateValue | datetime, date, time, datetimestamp, gyear, gyearmonth |
quantity | integer |
units | string |
Example
Query
PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-function-sample-queries/> PREFIX fn: <http://data.world/function/functions#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT (fn:date_sub("2001-01-01"^^xsd:date, 1, "day") as ?date_sub) { }
Table 2. Results
date-sub |
---|
2000-12-31 |