Bug report #14190

shapefile vector writer: datetime field saved as date resulting in data loss of time

Added by Mathieu Pellerin - nIRV about 1 year ago. Updated about 1 year ago.

Status:Closed Start Date:01/28/2016
Priority:High Due date:
Assigned to:- % Done:


Target version:Future Release - High Priority
Platform: Pull Request or Patch supplied:No
Platform version: Affected version:master
Status info: Causes crash or corruption:No
Resolution: Tag:


QGIS' vector writer does not handle datetime field correctly when saving a shapefile. The field gets transformed into a date field, and the time data is loss.

Steps to reproduce
  1. Create a new project, add the attached test.gpx vector layer (pick the track_point layer)
  2. Open the layer properties window, notice the time field is a "datetime".
  3. Right-click on the layer, and select "save as..."
  4. Select the "ESRI Shapefile" format, and save the layer (make sure [x] add saved file to map is checked, it'll make the next step easier)
  5. Open the layer properties window of the saved shapefile layer which was added to the project
  6. Go in the Fields panel, and notice the time field is now of type "date" (you can then open the attribute window and confirm that the time information has been lost)

Since ESRI Shapefile does not support a DateTime field type, it should be transformed to a string to preserve data, not a date.

test.gpx (1.2 kB) Mathieu Pellerin - nIRV, 01/28/2016 06:14 pm

Associated revisions

Revision a3f03f028a3a6be406ff21a17d988a41619e2439
Added by Jürgen Fischer about 1 year ago

vector file writer: fix saving of datetime values (fixes #14190)


Updated by Jürgen Fischer about 1 year ago

  • Status changed from Open to Closed

Also available in: Atom