我的数据集包含以下格式的时间戳:“8/27/2023 11:00:00 AM” 当摄取到 ADX 时,它们会被转换为“长”(看起来像这样:“['8_27_2023 11_00']” 如何通过 KQL 将它们转换为日期时间?
我已经在我的环境中重现了预期结果:
Input:
要更改为日期时间,请使用以下对我有用的
KQL Query
:
let x= datatable(col1: string)
[
"['8_27_2023 11_00']"
];
x
|extend col2=replace_string(col1,"['","")
|extend col3=replace_string(col2,"']","")
|extend co=split(col3," ")
|extend col4=replace_string(tostring(co[0]),"_","/")
|extend col5=replace_string(tostring(co[1]),"_",":")
|project-away col2,col3,co
|extend changedto_date_coll=todatetime(strcat(col4," ",col5))
|project-away col4,col5
Output: