TransWikia.com

Converting string column to datetime column in QGIS

Geographic Information Systems Asked by DrewGIS on July 17, 2021

I have an attribute column that has a string datetime and I want to convert that to a date column. I first attempted to simply add the time column in an expression, and I only got the year/month/date, but I wanted the time as well. So I first converted it the string to a new column with format_date(), to clean up the format, and then I went ahead and used to_datetime() to convert the string into the date column. It shows up fine in the Expression dialogue but then doesn’t add the hour/minute/seconds.

What am I overlooking?

Using
QGIS version
3.16.1-Hannover
on Windows

enter image description here

One Answer

You probably use shapefile format. Otherwise it should have worked.

According to the documentation shapefile format doesn't store date and time in the same field. You need to add date and time to seperate columns or use other format like GeoPackage.

Answered by Kadir Şahbaz on July 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP