Class: QgsDateTimeFieldFormatter

class qgis.core.QgsDateTimeFieldFormatter

Bases: 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.

Methods

defaultFormat

Gets the default format in function of the type.

id

rtype

str

representValue

param layer

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

Parameters

type (QVariant.Type) –

Return type

str

id(self) → str
Return type

str

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

  • fieldIndex (int) –

  • config (Dict[str) –

  • cache (Any) –

  • value (Any) –

Return type

str