TransWikia.com

Attribute table conversion date format

Geographic Information Systems Asked by Andrea H. on December 14, 2020

I want to change the date format with different date formats in the attribute table to the one format which is fitting for the Time manager. Does it work with the field calculator?
For example 12.August 2020 and I want to have 2020-08-12… Does anyone know how this works?

One Answer

To convert your example string (which I assume is not actually a date value):

to_date('12.August 2020', 'd.MMMM yyyy')

This will give a datetime value.

To convert it directly to the new format:

format_date(to_date('12.August 2020', 'd.MMMM yyyy'), 'yyyy-MM-dd')

Producing 2020-08-12

You will need to substitute your field name for '12.August 2020' for this to work, i.e.:

format_date(to_date("myDate", 'd.MMMM yyyy'), 'yyyy-MM-dd')

See here for information on date formats and string conversion, or look at the help in the field calculator for format_date().

Answered by Simbamangu on December 14, 2020

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