Removing the time zone from datetime field in QGIS

datetimefields-attributesqgisqgsexpressiontime zone

How can I get rid of the time zone in the date/time field?

So I have a GeoPackage with the following data:

enter image description here

and want to get just 2021-06-07 16:25:40

Best Answer

In my QGIS (3.22), when I use datetime format, I get timezone information included by default. You can convert it to a string to get rid of it - use this expression, where datetime is the name of the field containing the datetime-information:

left(to_string(datetime), 19)

However, you can't use the resulting string field as a datetime field any more. Including timezone makes sense - as 2021-12-06 14:48:41 is not the same everywhere on Earth.