I am adding spatial objects to a GeoPackage database. To register a new spatial table I use a formulation like:

INSERT INTO gpkg_contents
        (table_name, data_type, identifier, description, last_change, 
         min_x, max_x, min_y, max_y, srs_id)
VALUES ('location',
        'Relevant locations',
        -180, 180, -90, 90,

I use the validate_gpkg.py utility from GDAL to validate the resulting GeoPackage, and always get the same error:

Traceback (most recent call last):
  File "validate_gpkg.py", line 1673, in <module>
  File "validate_gpkg.py", line 1640, in check
  File "validate_gpkg.py", line 1614, in check
  File "validate_gpkg.py", line 312, in _check_gpkg_contents
    (last_change, table_name))
  File "validate_gpkg.py", line 88, in _assert
    raise GPKGCheckException('Req %s: %s' % (str(req), msg))
__main__.GPKGCheckException: Req 15: last_change = 2019-03-27 16:20:27 for table_name = profile is invalid datetime

Instead of DateTime('now') I have also tried with CURRENT_TIME and CURRENT_TIMESTAMP, but the result is always the same. How can I obtain a GeoPackage-valid time stamp to insert in the gpkg_contents table?

1 Answer 1


The geopackage spec[1] calls for ISO-8601 formatting.

You can get this format using strftime('%Y-%m-%dT%H:%M:%fZ','now')

[1] http://www.geopackage.org/spec/#r5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.