Class: QgsDateTimeFieldFormatter

class qgis.core.QgsDateTimeFieldFormatter

Bases: QgsFieldFormatter

Field formatter for a date time field.

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

QgsDateTimeFieldFormatter() Default constructor of field formatter for a date time field.

QgsDateTimeFieldFormatter(QgsDateTimeFieldFormatter)

Methods

defaultDisplayFormat

Gets the default display format in function of the type.

defaultFormat

Gets the default format in function of the type.

id

rtype:

str

representValue

param layer:

Attributes

DATETIME_DISPLAY_FORMAT

DATETIME_FORMAT

DATE_DISPLAY_FORMAT

DATE_FORMAT

DISPLAY_FOR_ISO_FORMAT

QT_ISO_FORMAT

TIME_FORMAT

DATETIME_DISPLAY_FORMAT = 'yyyy-MM-dd HH:mm:ss'
DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss'
DATE_DISPLAY_FORMAT = 'yyyy-MM-dd'
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'
defaultDisplayFormat(type: QVariant.Type) str

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

  • QVariant.DateTime

  • QVariant.Date

  • QVariant.Time

New in version 3.30.

Parameters:

type (QVariant.Type) –

Return type:

str

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