How can I convert time difference into milliseconds in Azure Application Insights
let startTime = todatetime('2017-05-15T17:02:23.7148691Z');
let endTime = todatetime('2017-05-15T17:02:25.5430172Z');
let timeDifference = endTime-startTime;
requests
| project timeDifference
| limit 1
The above query outputs
00:00:01.8281481
I would like to display it in milliseconds
For ex: 1828
You can divide your timespan by another timespan. So, to get number of milliseconds you can do the following:
let startTime = todatetime('2017-05-15T17:02:23.7148691Z');
let endTime = todatetime('2017-05-15T17:02:25.5430172Z');
let timeDifference = endTime-startTime;
// get total milliseconds
requests
| extend timeDifferenceMilliseconds = timeDifference / time(1ms)
| project timeDifferenceMilliseconds
| limit 1
More about date and time expressions can be found here: https://learn.microsoft.com/en-us/azure/application-insights/app-insights-analytics-reference#date-and-time-expressions