Document toolboxDocument toolbox

Leap year (isleapyear)

Description

Checks if the year corresponding to a given timestamp is a leap year or not. Optionally, you can check it in a timezone different than yours.

How does it work in the search window?

Select Create column in the search window toolbar, then select the isleapyear operation.

If you only add the Timestamp argument, you will get the leap year considering your current timezone. Optionally, you can specify a different time zone adding the Time zone argument to see whether there is a leap year in the specified time zone. 

Argument

Data type

Description

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:

  1. A time zone code→ UTC, PST, CST, etc. Check the full list here.

  2. The time zone database name → America/Los_Angeles, Europe/Amsterdam, Asia/Tokyo, etc. For the full list, see here.

  3. The full name of the time zone →  Universal Time Coordinated, Pacific Standard Time, Central Standard Time, etc. Check the full list here.

  4. The name of the region as it appears in Devo → Asia/Shanghai, Europe/Athens, America/New York, etc. You can check the time zone codes and region names in the Configure Timezone window in Devo.

Be aware that some of the codes coincide, as CST could mean Central Standard Time or China Standard Time. In that case, it would be advisable to avoid using codes and introduce any of the other formats mentioned.



The data type of the new column values will be boolean (true if the year is a leap year and false if no leap year was found).

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 siem.logtrust.web.activity table, we want to create a column that indicates whether the year of the dates in our eventdate column is a leap year. To do it, we will create a new column using the isleapyear operation.

The arguments needed to create the new column are:

  • Timestamp - eventdate column

Let's say we need to adapt the timezone for France. Click New Argument to add the Time Zone. Click the pencil icon and specify the time zone in France (CET or Central European Time) or any other.

Click Create column and you will see the following result:

How does it work in LINQ?

Use the operator select... as...  and add the operation syntax to create the new column. These are the valid formats for the Year operation:

  • isleapyear(timestamp) → Use this expression to get the leap year corresponding to the given timestamps, according to your current time zone.

  • isleapyear(timestamp, timezone_string) →  Use this expression to get the leap year corresponding to the given timestamps, according to the specified time zone.

Example

You can copy the following LINQ script and try the above example on the siem.logtrust.web.activity table.

from siem.logtrust.web.activity select isleapyear(eventdate, "CET") as eventdate_leapyear