Skip to main content

date_part

The date function used to find the numeric value for a part of a date or datetime value. It takes two arguments: the date to be evaluated and the unit of time to find from it (one of "timezone", "timezonehour", "timezoneminute", "year", "decade", "century", "quarter", "month", "week", "day", "dayofweek", "dayofyear", "hour", "minute", "second", or "millisecond").

Returns: integer

Table 1.

Parameter

Type

units

string

dateValue

datetime, date, time, datetimestamp, gyear, gyearmonth



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_part("day", "2001-01-12"^^xsd:date) as ?date_part)
{
}

Try the query

Table 2. Results

date_part

12