Class: QgsProcessingParameterDateTime

class qgis.core.QgsProcessingParameterDateTime(name: str, description: str = '', type: QgsProcessingParameterDateTime.Type = QgsProcessingParameterDateTime.DateTime, defaultValue: Any = None, optional: bool = False, minValue: Union[QDateTime, datetime.datetime] = QDateTime(), maxValue: Union[QDateTime, datetime.datetime] = QDateTime())

Bases: QgsProcessingParameterDefinition

Constructor for QgsProcessingParameterDateTime.

QgsProcessingParameterDateTime(QgsProcessingParameterDateTime)

A datetime (or pure date or time) parameter for processing algorithms.

QgsProcessingParameterDateTime should be evaluated by calling QgsProcessingAlgorithm.parameterAsDateTime(), which will return a date time value.

New in version 3.14.

Parameters
  • name (str) –

  • description (str = '') –

  • type (QgsProcessingParameterDateTime.Type = QgsProcessingParameterDateTime.DateTime) –

  • defaultValue (Any = None) –

  • optional (bool = False) –

  • minValue (Union[QDateTime) –

  • maxValue

Date = 1
DateTime = 0
Time = 2
class Type

Bases: int

asPythonString(self, outputType: QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) → str
Parameters

outputType (QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) –

Return type

str

checkValueIsAcceptable(self, input: Any, context: QgsProcessingContext = None) → bool
Parameters
Return type

bool

clone(self)QgsProcessingParameterDefinition
Return type

QgsProcessingParameterDefinition

dataType(self)QgsProcessingParameterDateTime.Type

Returns the acceptable data type for the parameter.

See also

setDataType()

Return type

QgsProcessingParameterDateTime.Type

fromScriptCode(name: str, description: str, isOptional: bool, definition: str)QgsProcessingParameterDateTime

Creates a new parameter using the definition from a script code.

Parameters
  • name (str) –

  • description (str) –

  • isOptional (bool) –

  • definition (str) –

Return type

QgsProcessingParameterDateTime

fromVariantMap(self, map: Dict[str, Any]) → bool
Parameters

map (Dict[str) –

Return type

bool

maximum(self) → QDateTime

Returns the maximum value acceptable by the parameter.

An invalid QDateTime value indicates no maximum value.

See also

setMaximum()

Return type

QDateTime

minimum(self) → QDateTime

Returns the minimum value acceptable by the parameter.

An invalid QDateTime value indicates no minimum value.

See also

setMinimum()

Return type

QDateTime

setDataType(self, type: QgsProcessingParameterDateTime.Type)

Sets the acceptable data type for the parameter.

See also

dataType()

Parameters

type (QgsProcessingParameterDateTime.Type) –

setMaximum(self, maximum: Union[QDateTime, datetime.datetime])

Sets the maximum value acceptable by the parameter.

An invalid QDateTime value indicates no maximum value.

If the dataType() is QgsProcessingParameterDateTime.Time, then the date component of maximum must be set to any valid date (but this date will not actually be considered when comparing parameter values to the specified maximum value, only the time component will be considered).

See also

maximum()

Parameters

maximum (Union[QDateTime) –

setMinimum(self, minimum: Union[QDateTime, datetime.datetime])

Sets the minimum value acceptable by the parameter.

An invalid QDateTime value indicates no minimum value.

If the dataType() is QgsProcessingParameterDateTime.Time, then the date component of minimum must be set to any valid date (but this date will not actually be considered when comparing parameter values to the specified minimum value, only the time component will be considered).

See also

minimum()

Parameters

minimum (Union[QDateTime) –

toVariantMap(self) → Dict[str, Any]
Return type

Dict[str, Any]

toolTip(self) → str
Return type

str

type(self) → str
Return type

str

typeName() → str

Returns the type name for the parameter class.

Return type

str

valueAsPythonString(self, value: Any, context: QgsProcessingContext) → str
Parameters
Return type

str