Subgroup: Date

Class: QgsDateTimeFieldFormatter

class qgis.core.QgsDateTimeFieldFormatter

Bases: qgis._core.QgsFieldFormatter

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: Methods

alignmentFlag Return the alignment for a particular field.
createCache Create a cache for a given field.
defaultFormat Get the default format in function of the type.
id
representValue
sortValue If the default sort order should be overwritten for this widget, you can transform the value in here.

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

Get 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