How to remove time part from a datetime in Kusto

Viewed 6180

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?

1 Answers

Use the startofday() function:

startofday( now() )

or the bin() function:

bin( now(), 1d )
Related