Day of the year (dayofyear)
Returns the day of the year from a given timestamp. Optionally, you can add a timezone different than your current one.
How does it work in the search window?
Select Create column in the search window toolbar, then select the Day of the year operation.
If you only add the Timestamp argument, you will get the day of the year considering your current timezone. Optionally, you can specify a different time zone adding the Time zone argument.
The data type of the new column values is integer. It will show values 0-365, where 0 is the first day of the year and 365 is the last one.
demo.ecommerce.data table, we want to create a column that indicates the day of the year of the dates in our eventdate column. To do it, we will create a new column using the Day of the year operation.
The arguments needed to create the new column are:
- Timestamp - eventdate column
Click Create column and you will see the following result:
How does it work in LINQ?
Use the operator
as... and add the operation syntax to create the new column. These are the valid formats for the Day of the year operation:
dayofyear(timestamp)→ Use this expression to get the day of the year corresponding to the given timestamps, according to your current time zone.
dayofyear(timestamp, timezone_string)→ Use this expression to get the day of the year corresponding to the given timestamps, according to the specified time zone.
You can copy the following LINQ script and try the above example on the
from demo.ecommerce.data select dayofyear(eventdate) as eventdate_day_year