Rory
Rory

Reputation: 41807

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?

Upvotes: 20

Views: 25218

Answers (1)

Rory
Rory

Reputation: 41807

Use the startofday() function:

startofday( now() )

or the bin() function:

bin( now(), 1d )

Upvotes: 31

Related Questions