Praveen Reddy
Praveen Reddy

Reputation: 7383

Extract time portion out of Timestamp

I am using Azure Application insights and would like to extract just the time portion out of Timestamp.

For ex:

   Input : "2017-01-23T20:00:00.2804261Z"; //This is a Timestamp data type
   Output : 20:00:00.2804261Z

Upvotes: 1

Views: 2513

Answers (1)

Dmitry Matveev
Dmitry Matveev

Reputation: 2679

You can subtract day from the existing timestamp to leave only the "time" part of it:

QueryHere
| extend date_output = floor(timestamp, 1d)
| extend time_output = timestamp - date_output 

The output will be something like

Timestamp: "2017-01-23T20:00:00.2804261Z"
date_output: "2017-01-23T00:00:00.0000000Z"
time_output: "20:00:00.2804261"

Upvotes: 2

Related Questions