I have a shapefile with date in a string
field. I create a new field with date
type and use the calculator to make the conversion. But the result only provide the date part, the time part is removed. Even when the preview show the correct conversion.
Here you can see the original string field time
and the result date time2
. And the use of the conversion function to_datetime()
and the preview result at the end
If you go to the layer properties you can change the edit mode to date/time. Then if go to the data and try to edit time2
you get the current date/time. So is possible save date and time in the same field. But the update tool still doesn't work as expected
As J.R said. Even when you can change QGIS edit to allow Date/Time the save to shapefile will discard the time.
Date
field only allows you to store up to 10 characters, enough forYYYY-MM-DD
. If you want to also store the time, use aString
field instead and set a larger character length value :)