How to Format Date and Time in Kusto Query | DateTime Format Function in Kusto

Topic: How to Format Date and Time in Kusto Query Language

In this article, we are going to learn about to format_date time functions so often we need to format the date and time according to our requirement maybe we want to create a report and export to excel and all that and we would like to export that date time specific formatKusto Query Language is a powerful tool to explore your data and discover patterns, identify anomalies and outliers, create statistical modeling, and more. The query uses schema entities that are organized in a hierarchy similar to SQL's: databases, tables, and columns.


 //format_datetime() -- Formats a datetime according to the provided format.  
 // This has alot of formats, check this out  
 //https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/format-datetimefunction  
 //Let's create a table Customer  
 //.drop table Customer  
 .create table Customer (CustomerId: long, FName: string,LName:string, Salary: int,hiredate:datetime)   
  .ingest inline into table Customer <|  
 1,Aamir,Shahzad,2000,2021-11-28T04:52:43.8745893Z  
 2,Raza,ALI,4000,2018-11-28T04:52:43.8745893Z  
 3,Lisa,Rivers,50000,2021-12-28T04:52:43.8745893Z  
 4,steve,Ladson,1000,2010-09-28T04:52:43.8745893Z  
 5,Robert,Jr,500,2015-01-20T04:52:43.8745893Z  
 6,aamir,ali,1000,2005-03-01T04:52:43.8745893Z  
 Customer  
 | extend   
 SampleFormat1=format_datetime(hiredate,'y-M-d')  
 ,SampleFormat2=format_datetime(hiredate,'yy-MM-dd')  
 ,SampleFormat3=format_datetime(hiredate,'yyyy:MM:dd')  
 ,SampleFormatTime=format_datetime(hiredate,'h:m:s')  

Video Demo: How to Format Date and Time in Kusto Query

1 comment:

  1. Get the best business assignment help online from a top-rated assignment expert. We have over ten years of assignment assistance experience. accounting essay assignment help offers all types of assignment assistance to college and university students. For all assignment help, our assignment helpers in uk guarantee on-time delivery and plagiarism-free content.

    ReplyDelete