azureazure-data-explorer

Is it possible to change the day returned from startofweek() and endofweek()?


Kusto provides functions to get the start- and end-day of the week. These are invoked through startofweek() and endofweek(). startofweek() returns Sunday, and endofweek() returns Saturday.

In some countries, weeks are from Monday to Sunday, which I have been unable to locate how to change.

Is it possible to set the culture in kusto, such that startofweek() and endofweek() would return Monday and Sunday respectively?


Solution

  • No, I have not seen a setting where culture can be set in Kusto. Where operating systems and applications which make it possible to set such configurations, I see Kusto being being fairly basic and similar to .NET libraries where the DayOfWeek enum begins with Sunday at index 0 and there is no way to change that foundation.

    The documentation indicates that "Start of the week is considered to be a Sunday." so I believe that is that. It is up to us users to adapt from there. (https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/startofweekfunction)

    I'm sure you have done this yourself already, but here has been my approach.

    startofweek(now()) + 1d
    endofweek(now()) + 1d