'How to remove time part from a datetime in Kusto

If I've got a Kusto datetime and I want to remove the time portion, leaving just a date at midnight, what's the best way? I can do this

todatetime(format_datetime( now(), "yyyy-MM-dd"))

but surely there's a more efficient way?



Solution 1:[1]

Use the startofday() function:

startofday( now() )

or the bin() function:

bin( now(), 1d )

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rory