Home

Day of week function?

Mike Watson
Occasional Visitor

I'm trying to write a query that will return results where the TimeGenerated value is greater than the date of the last Friday (for example).  Is there a way to do this in KQL?  Thanks!

1 Reply

Hi Mike,

As far as I know, you can get the "day of week" for a specific date, but not the other way around (date of a specific day in the week). Here's an example:

print(dayofweek(datetime(2018-10-29))) 

The result is the number of days since Sunday. In the example above, the result is 1 which means Monday. You can read more about this function here and review the language reference for alternatives, if you prefer.

 

HTH,

Noa