hour function in the Factory

The hour function returns the hour value of time.


Parameters

hour(time)

Parameter

Description

time

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

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

  • 2019/05/22 17:33:45

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

  • 17:27:35;

  • 17:27:35.120;

  • 17:27


Example

The following example uses the Instagram_data dataset.

Description

Screenshot

In this example, we want to create a new attribute with the hour the posts were created, which is now contained in the Date Posted attribute.

We create a new attribute, called hour function, and write the following formula:

hour($"Date Posted")

and the attribute will be filled with the hour only.