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(a0: QgsDateTimeFieldFormatter)

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

Added in version 3.30.

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

Added in version 3.30.

Deprecated since version QGIS: 3.38 use the method with a QMetaType.Type argument instead

Parameters:

type (QMetaType.Type)

Return type:

str

defaultFormat(type: QMetaType.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

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

Deprecated since version QGIS: 3.38 use the method with a QMetaType.Type argument instead

Parameters:

type (QMetaType.Type)

Return type:

str

id(self) str
Return type:

str

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

  • fieldIndex (int)

  • config (Dict[str)

  • cache (Any)

  • value (Any)

Return type:

str