DateTime part function in Kusto | How to get Year, Month and Day from DateTime | KQL Tutorial 2022

Topic: DateTime part function in Kusto Query Language.

In this article, we are going to learn about datetime_part function, this function is very helpful and we can extract different parts of the data by using this function so it extracts the requested data part as the integer value. Kusto 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.


 //datetime_part -- Extracts the requested date part as an integer value.  
 Part supported  
 Year  
 Quarter  
 Month  
 week_of_year  
 Day  
 DayOfYear  
 Hour  
 Minute  
 Second  
 Millisecond  
 Microsecond  
 Nanosecond  
   

 //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   
 year=datetime_part('year',hiredate)  
 ,Quarter=datetime_part('Quarter',hiredate)  
 ,Month=datetime_part('Month',hiredate)  
 ,week_of_year=datetime_part('week_of_year',hiredate)  
 ,Day=datetime_part('Day',hiredate)  
 ,DayOfYear=datetime_part('DayOfYear',hiredate)  
 ,Hour=datetime_part('Hour',hiredate)  
 ,Minute=datetime_part('Minute',hiredate)  
 ,Second=datetime_part('Second',hiredate)  
 ,Millisecond=datetime_part('Millisecond',hiredate)  
 ,Microsecond=datetime_part('Microsecond',hiredate)  
 ,Nanosecond=datetime_part('Nanosecond',hiredate)  

Video Demo: DateTime part function in Kusto | How to get Year, Month and Day from DateTime | KQL Tutorial 2022

4 comments:

  1. Thank you so much for sharing this informative information with us. Yeah, we're going to learn about the datetime part function in this post. This function is quite useful since it allows us to extract different portions of the data. It extracts the requested data part as an integer value. Anyway, I'm currently on the lookout for a english literature dissertation. In the meanwhile, I enjoyed your post and appreciate you sharing it.

    ReplyDelete
  2. Brothers/Sister's. Are you looking for loan to finance your large or small business,we'll help you get the large amount of loan you desire for your business,we offer first class business and commercial loan to enable small scale business attain success in obtaining start up or refinance their business Bad credit rating accepted and poor business performance are accepted.apply today

    Are you a business man or woman? Do you need funds to start up your own business? Do you need loan to settle your debt or pay off your bills or start a nice business? Do you need funds to finance your project? We Offers guaranteed loan services of any amount and to any part of the world for (Individuals, Companies, Realtor and Corporate Bodies) at our superb interest rate of 3%. For application and more information send replies to the

    via email ronniefinancehome247@gmail.com
    Whats App +91 93118 56893
    LOAN APPLICATION FORM
    Name:
    Sex:
    Address:
    Occupation:
    State:
    Country:
    Phone Number:
    Loan Duration:
    Loan Needed:
    Have you applied before?:
    Email us ronniefinancehome247@gmail.com
    Whats-App +91 93118 56893
    Dr. Mark Thomas

    ReplyDelete
  3. I decided to withdraw my profit,to my How To Finance A Car – A Complete Guide! surprise I was unable to withdraw,i tried reaching the website
    administrator,i was then asked to invest more money

    ReplyDelete