Table of Contents | ||||
---|---|---|---|---|
|
...
Select Create column in the search window toolbar, then select the Hour operation.
This operation can be applied with no arguments. In this case, you will get the duration representation of 1 hour (duration data type, 1h).
If you add the Timestamp argument, you will get the hours considering your current timezone. Optionally, you can add the Time zone argument to see the hours in the specified time zone.
Argument | Data type | Description | ||
---|---|---|---|---|
Timestamp mandatory | timestamp | You can either select a column with that data type or introduce it manually. In case you want to introduce it, note that this value should be a date: Year-Month_Day Hour:Minute:Second.Millisecond (yyyy-MM-dd HH:mm:ss.SSS) → You can skip seconds and milliseconds. | ||
Time zone | string | You need a valid string format the app can recognize so it returns meaningful results. If you leave the field empty or introduce a value the app cannot recognize, the default Time Zone is UTC. You can use one of the following methods:
|
The data type of the new column values will be integer and the values shown will be 0-23.
Info |
---|
Be aware that timestamps taking place during summer will be affected in the time zones in which they set the clock forward during summer. For example, Europe/Madrid (CET-Central European Time), which is UTC+1, becomes UTC+2 during summertime and thus timestamps in August will be affected when using that time zone. Be also aware that summertime differs between the Northern and Southern Hemispheres. |
Example
In the demo.ecommerce.data
table, we want to create a column showing the hours of the dates in our eventdate column. To do it, we will create a new column using the Hour operation.
...
The column shows 8 in the events that took place at that hour, regardless of the minute, second and millisecond, which corresponds to the hour shown in the eventdate column.
...
Now we want to create a column in the demo.ecommerce.data
table to show in EET time (Eastern European Time, UTC+2) the hours of the dates in our eventdate column. To do it, we will create a new column using the Hour operation.
...
hour()
→ Use this expression to get the representation of one hour in duration data type (1h).hour(timestamp)
→ Use this expression to get the hours of the given timestamps, according to your current time zone.hour(timestamp, timezone_string)
→ Use this expression to get the hours of the given timestamps, according to the specified time zone.
Example
You can copy the following LINQ script and try the previous examples on the demo.ecommerce.data
table.
Code Block |
---|
from demo.ecommerce.data select hour(eventdate) as eventdate_hours |
...