Is there a way to configure rdflib serializer to use a specific UTC date format?

155 views Asked by At

I have a server that rejects a triple using the UTC offset syntax: rtc_cm:due "2020-09-08T14:30:00+00:00"^^xsd:dateTime (Turtle)

but succeeds using the Z suffix: rtc_cm:due "2020-09-08T14:30:00Z"^^xsd:dateTime (Turtle)

Is there a way to configure the Python rdflib serializer to prefer the Z suffix for UTC dates.

I noticed that rdflib.util.date_time() seems to do that, but the serializer does not, at least by default.

1

There are 1 answers

0
Nicholas Car On

If you're using timezones, you need to use the literal xsd:dateTimeStamp.

See https://www.w3.org/TR/xmlschema11-2/#dateTimeStamp