Forum Discussion

Matthias Stier's avatar
Matthias Stier
Copper Contributor
May 08, 2018

Conversion of epoch / unixtimestamps within Log Analytics

 we re using a lot of epoch / unixtimestamps (seconds since 1970-1-1) in our solution and are wondering right now if there is the possibilty to convert those timestamps to datetime objects within loganalytics queries? Unfortunately we couldn't find anything in the documentation on that matter. Would be great if someone could point us in the right direction.

3 Replies

  • DevOps220's avatar
    DevOps220
    Copper Contributor

    Matthias Stier 

     

    Please use the following function to convert into the date and time 

    unixtime_seconds_todatetime(epoch value)
     

     

  • maybe?

     

    datatable (unixtime:string)
    [
    915148798.75,
    915148799.00,
    915148799.25,
    915148799.50,
    915148799.75
    ]
    | project todatetime(unixtime)
     
     
    // line 1 of the result would be "1998-12-31T23:59:58.000" 
     

Resources