Forum Discussion

dudeed's avatar
dudeed
Copper Contributor
Dec 16, 2020
Solved

Why doesn't datetime(tostring(now())) work?

I ask b/c I am using parameters like

 

let start_time = datetime({startTime});
let end_time = datetime({endTime});

 

and since you don't support datetime(datetime) so I could pass, say, a startTime=now(),

 

I try to pass the tostring(now()) but that doesnt' work either.

 

What is the proper way to pass a parameter and construct a datetime out of the parameter value, if I am testiong in Kusto explorer and want to manually drive my query? The query must remain as-is, in accepting a datetime({startTime}) style as it is all throughout our team's parameterized queries in dashboards, etc.

  • dudeed , instead of datetime you should use todatetime - this works:

    print todatetime(tostring(now()))

     

1 Reply

  • dudeed , instead of datetime you should use todatetime - this works:

    print todatetime(tostring(now()))

     

Resources