Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at the 2025 Microsoft Fabric Community Conference. March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for $400 discount. Register now

Reply
pmscorca
Post Patron
Post Patron

Returning a date column in a KQL table or materialized view

Hi,

is it possible to have in a KQL table or materialized view a date column with a such value '2024-10-24' and

not '2024-10-24 00:00:00.000'?

I'm trying to use todatetime() and format_datetime but unsuccessfully, I'd like to remove the time.

Thanks

1 ACCEPTED SOLUTION
v-junyant-msft
Community Support
Community Support

Hi @pmscorca ,

The function format_datetime is available to fulfill your needs, please check the following KQL Query:

datatable(DateTimeColumn: datetime)
[
    datetime(2024-10-24 13:45:00.000),
    datetime(2024-10-25 09:30:00.000),
    datetime(2024-10-26 17:15:00.000)
]
| extend DateOnly = format_datetime(DateTimeColumn, "yyyy-MM-dd")

And the final output is as below:

vjunyantmsft_0-1729817134606.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-junyant-msft
Community Support
Community Support

Hi @pmscorca ,

The function format_datetime is available to fulfill your needs, please check the following KQL Query:

datatable(DateTimeColumn: datetime)
[
    datetime(2024-10-24 13:45:00.000),
    datetime(2024-10-25 09:30:00.000),
    datetime(2024-10-26 17:15:00.000)
]
| extend DateOnly = format_datetime(DateTimeColumn, "yyyy-MM-dd")

And the final output is as below:

vjunyantmsft_0-1729817134606.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements