Forum Discussion

Gully's avatar
Gully
Frequent Visitor
3 years ago
Solved

Converting different date formats to same format.

I am new to PowerBI and am having issues formatting a column with different date formats.

I have the following 3 types of date in a text field. Every time I try to convert the column to a date format at least one comes back with 'Error'. 

CreationDate
8/26/2022 7:16:32 AM      - missing leading zero for month and includes seconds
09/02/2022 17:50             - uses 24 hour clock. 
09/01/2022 7:32 PM         - uses 12 hour clock. 

How to I make the date format consistant ?

 

Many thanks,

Gully.

 

  • Hi Gully,

     

    I created a table with datetime values in the 3 formats given by you.

     

     

    There shouldn't be any issue in converting all of these to datetime. Select Date/Time as the data type.

     

     

    Result:

     

     

    Works for you? Mark this post as a solution if it does!
    Consider taking a look at my blog: Forecast Period - Graphical Comparison 

3 Replies

  • Shaurya's avatar
    Shaurya
    Memorable Member

    Hi Gully,

     

    I created a table with datetime values in the 3 formats given by you.

     

     

    There shouldn't be any issue in converting all of these to datetime. Select Date/Time as the data type.

     

     

    Result:

     

     

    Works for you? Mark this post as a solution if it does!
    Consider taking a look at my blog: Forecast Period - Graphical Comparison 

  • Gully's avatar
    Gully
    Frequent Visitor

    Hi, Shaurya.

    Thanks for your response. I followed your steps and it still didn't work. 

    I then reloaded the data and followed your steps again and it worked.

    I'm not sure what happened but all is good now.

    Thanks,

    Gully

  • CaioBauab's avatar
    CaioBauab
    Regular Visitor

    Hello!

     

    I have a different mix of locales at same column as en-US and es-MX:

     

    1/22/2023 8:13:01 AM

    25/05/2020 08:00:19 p. m.

     

    When I try to convert using locale in two steps, I got an error for the second one.

     

    Any hint will be appreciate!