DATETIME

DATETIME(year, month, day, hours, minutes, seconds)[source]

Constructs a datetime from the given year, month, day, hour, minute, and second components.

The DATETIME function returns a valid datetime using the specified components. It supports both single values and arrays; if arrays are provided, they must all have the same length, otherwise the returned formula will evaluate to an error.

Parameters:
  • year (Operand | int) – The year component.

  • month (Operand | int) – The month component (1–12).

  • day (Operand | int) – The day component.

  • hours (Operand | int) – The hour component (0–23).

  • minutes (Operand | int) – The minute component (0–59).

  • seconds (Operand | int) – The second component (0–59).

Return type:

Formula

Returns:

A Formula object representing the constructed datetime. If the inputs do not form a valid date/time, the formula will evaluate to an error.

Raises:

ValueError – If any input is not numeric or an array of numeric values.

``year`` — accepted types

  • DECIMAL

  • DECIMAL_ARRAY

  • INTEGER

  • INTEGER_ARRAY

``month`` — accepted types

  • DECIMAL

  • DECIMAL_ARRAY

  • INTEGER

  • INTEGER_ARRAY

``day`` — accepted types

  • DECIMAL

  • DECIMAL_ARRAY

  • INTEGER

  • INTEGER_ARRAY

``hours`` — accepted types

  • DECIMAL

  • DECIMAL_ARRAY

  • INTEGER

  • INTEGER_ARRAY

``minutes`` — accepted types

  • DECIMAL

  • DECIMAL_ARRAY

  • INTEGER

  • INTEGER_ARRAY

``seconds`` — accepted types

  • DECIMAL

  • DECIMAL_ARRAY

  • INTEGER

  • INTEGER_ARRAY

Return types

  • DATETIME

  • DATETIME_ARRAY