Class: QgsDateTimeFieldFormatter

class qgis.core.QgsDateTimeFieldFormatter

Bases: qgis._core.QgsFieldFormatter

Default constructor of field formatter for a date time field.

QgsDateTimeFieldFormatter(QgsDateTimeFieldFormatter)

Field formatter for a date time field. This represents a date, time or datetime value based on the field configuration.

New in version 3.0: Enums

Methods

defaultFormat

Gets the default format in function of the type.

id

representValue

Signals

Attributes

DATETIME_FORMAT

DATE_FORMAT

DISPLAY_FOR_ISO_FORMAT

QT_ISO_FORMAT

TIME_FORMAT

DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss'
DATE_FORMAT = 'yyyy-MM-dd'
DISPLAY_FOR_ISO_FORMAT = 'yyyy-MM-dd HH:mm:ss+t'
QT_ISO_FORMAT = 'Qt ISO Date'
TIME_FORMAT = 'HH:mm:ss'
defaultFormat(type: QVariant.Type) → str

Gets the default format in function of the type. The type is expected to be one of

  • QVariant.DateTime

  • QVariant.Date

  • QVariant.Time

id(self) → str
representValue(self, layer: QgsVectorLayer, fieldIndex: int, config: Dict[str, Any], cache: Any, value: Any) → str