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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to change type of datetime column

I have a column of dates and times as shown below. It is currently in text type but when I try changing to date/time, I get an error saying "we can't automatically convert the column to date/time type".  The column was created from a Python script by converting a date column in another table to a python list, doing some calculations then putting the list into a dataframe. I'm guessing it's because of the "T" but don't know how to remove it or put a space there instead.

 

XYZ1233_0-1646310234740.png

 

1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

HI @Anonymous ,

 

The values in your datatime column contain a text character T which doesn't make values in the right format as expected in Power BI.

What you can do is, just replace T with a single space character in this column in Power Query Editor and then try changing it's datatype to datetime. It should work.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Pragati11 ,

 

I just replaced it with a space but I get the same error again. Any idea why?

HI @Anonymous ,

 

You will need to remove the last part of your date value as well which is highlghted below:

2021-12-23T12:17:37.780000

 

You can use EXTRACT before delimiter option in Power Query editor to do this. This can be found under Transform option:

Pragati11_0-1646313284534.png

In your case delimiter will be dot operator. Setting should be something like below:

Pragati11_1-1646313409129.png

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Pragati11
Super User
Super User

HI @Anonymous ,

 

The values in your datatime column contain a text character T which doesn't make values in the right format as expected in Power BI.

What you can do is, just replace T with a single space character in this column in Power Query Editor and then try changing it's datatype to datetime. It should work.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.