datetime function

The datetime function returns in each row of the result the datetime value obtained by the composition of the date value contained in the date entry and the time value contained in the time entry.


Parameters

datetime(date, time)

Parameter

Description

date

The date, week, month, quarter, datetime attribute type from which we want to cast the datetime. The date parameter is mandatory.

time

The time or datetime attribute type from which we want to cast the datetime. The time parameter is mandatory.

Date type valid formats (if the values aren’t this format, the function will return an error).

  • 2019/10/12;

  • 12/10/2019;

  • 2019-10-12;

  • 12-10-2019;

  • 2019/Oct/12;

  • 12/Oct/2019;

  • 2019-Oct-12;

  • 12-Oct-2019.

Week type valid formats (if the values aren’t this format, the function will return an error).

  • 2019/W41;

  • W41/2019;

  • 2019-W41;

  • W41-2019.

Month type valid formats (if the values aren’t this format, the function will return an error).

  • 1492/10;

  • 10/1492;

  • 1492-10;

  • 10-1492;

  • 1492/Oct;

  • 1492-Oct;

  • Oct/1492;

  • Oct-1492.

Quarter type valid formats (if the values aren’t this format, the function will return an error).

  • 2019/Q3;

  • Q3/2019;

  • 2019-Q3;

  • Q3-2019.

Datetime type valid formats (if the values aren’t this format, the function will return an error).

  • 2019/05/22 17:33:45


Example

The following example uses the datetime dataset.

Description

Screenshot

In this example, we want to fill a new attribute, called Datetime, with the date and time together.

We type the following formula:

datetime($"Date",$"Time")

and the attribute will be filled with the combination of the date and time.