[QGIS-Developer] QGIS Date, Time and Time Zones

Even Rouault even.rouault at spatialys.com
Thu Apr 29 11:18:03 PDT 2021


>  but the question I have is whether a vector layer were saved to 
> something like a GPKG would the timezone even be preserved?

Short answer: not by default

Longer answer:

- see https://github.com/opengeospatial/geopackage/issues/530

- and https://github.com/OSGeo/gdal/issues/3423#issuecomment-772405674

- and https://gdal.org/drivers/vector/gpkg.html#dataset-creation-options

So basically:

- the GeoPackage spec only supports date/time encoded as ISO 8601 with 
Zulu timezone : "YYYY-MM-DDTHH:MM:SS.SSSZ"

- on reading side, the OGR Geopackage driver can understand non-Zulu 
timezones

- on writing side, by default the OGR Geopackage driver will convert 
datetimes to the Zulu timezone (applying the appropriate shift), unless 
the DATETIME_FORMAT=WITH_TZ dataset creation option is passed at 
creation time, in which case the original timezone is preserved. Such 
datasets may not be read correctly by third party implementations.

Even


http://www.spatialys.com
My software is free, but my time generally not.



More information about the QGIS-Developer mailing list