1

I need to make a date format in QGIS 3 but, in the program I need to use, QgsEditorWidgetSetup('Date',{'yyyymmdd'}), I want to get this:

here is what i want to have

But I don't know how to use QgsEditorWidgetSetup to make the date looks like above image. Can you help me, please?

1

This is my answer:

config = {'allow_null': True,
              'calendar_popup': True,
              'display_format': 'yyyyMMdd',
              'field_format': 'yyyyMMdd',
              'field_iso_format': False}
type = 'DateTime'
setup = QgsEditorWidgetSetup(type,config)
layer.setEditorWidgetSetup(6,setup)

I found it out because of following lines:

field = layer.fields()[6]
field.editorWidgetSetup().config()
field.editorWidgetSetup().type()

Qgis shows you all info to make it on code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.