Class: QgsDateTimeFieldFormatter

Field formatter for a date time field.

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

Class Hierarchy

Inheritance diagram of qgis.core.QgsDateTimeFieldFormatter

Base classes

QgsFieldFormatter

A field formatter helps to handle and display values for a field.

Static Methods

defaultDisplayFormat

Gets the default display format in function of the type.

defaultFormat

Gets the default format in function of the type.

Attributes

DATETIME_DISPLAY_FORMAT

DATETIME_FORMAT

DATE_DISPLAY_FORMAT

DATE_FORMAT

DISPLAY_FOR_ISO_FORMAT

QT_ISO_FORMAT

TIME_FORMAT

class qgis.core.QgsDateTimeFieldFormatter[source]

Bases: QgsFieldFormatter

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'
static defaultDisplayFormat(type: QMetaType.Type) str[source]

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.

Parameters:

type (QMetaType.Type)

Return type:

str

static defaultDisplayFormat(type: QVariant.Type) str[source]

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 3.38: Use the method with a QMetaType.Type argument instead.

Parameters:

type (QVariant.Type)

Return type:

str

static defaultFormat(type: QMetaType.Type) str[source]

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 (QMetaType.Type)

Return type:

str

static defaultFormat(type: QVariant.Type) str[source]

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 3.38: Use the method with a QMetaType.Type argument instead.

Parameters:

type (QVariant.Type)

Return type:

str