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.

1 Reply
best response confirmed by slavikn (Microsoft)

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

print todatetime(tostring(now()))