microsoft / Kusto-Query-Language

Kusto Query Language is a simple and productive language for querying Big Data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

format_datetime datetime expected

albertoRamon opened this issue · comments

This works:

ADFActivityRun
| where TimeGenerated > ago(3d)
| extend  duration2 = (End - Start)

image

This fail:

 ADFActivityRun
| where TimeGenerated > ago(3d)
 extend duration2 = format_datetime((End - Start),'y-M-d h:m:s.fffffff')

image
image
image

Redundant but just in case, fail too

 ADFActivityRun
| where TimeGenerated > ago(3d)
extend duration2 = format_datetime((todatetime(End) - todatetime(Start)),'y-M-d h:m:s.fffffff')

image

The function format_datetime() expects datetime value (as error described).
For formating timespans: use https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/format-timespanfunction

End and Start, is date time
End - Start, is date time

and just in case: todatetime(start) is datetime

If End is datetime - and Start is datetime, then
End-Start is timespan

ohh, thanks !!