@daisha
To get the number of days between two dates using SPARQL, you can use the following query:
1 2 3 4 5 6 7 |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT (xsd:integer((?date2 - ?date1) / (24*60*60*1000)) AS ?days) WHERE { BIND ("2022-01-01T00:00:00"^^xsd:dateTime as ?date1) BIND ("2022-01-10T00:00:00"^^xsd:dateTime as ?date2) } |
In this query, you need to replace the date values "2022-01-01T00:00:00" and "2022-01-10T00:00:00" with the dates you want to calculate the difference between. The query calculates the difference in milliseconds between the two dates, then converts it to days by dividing by the number of milliseconds in a day. The result is stored in the variable ?days.