日期时间与字符串连接

Datetime concate with string

我想对此进行简化并将其用作开始时间参数。

let d=  format_datetime(now(),'yyyy-MM-dd');
let t= "T10:00:00.000Z";  
let str= strcat(d,t);
let dt= todatetime(str); 
print dt

5/6/2020,10:00:00.000 AM

我一直想 return 今天的 yyyy-MM-dd 但硬编码了时间

我的方法很有效,但我希望有更好的方法

谢谢

更好的变体是避免字符串创建和解析,而是使用日期时间算术运算:

https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/scalarfunctions#datetimetimespan-functions

let dt = startofday(now())+10h;
print dt