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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
pforchito
New Member

Convert date format (2019-11-28T21:24:27.427Z) to a Power Bi date

Hello Experts!

 

Unfortunately there are many DATE and TIME formats and I'm facing a challenge in converting from one specific format to another that PowerBI recognizes as date time hierarchy.

 

The original format is YYYY-MM-DDT24HH:MM:SS.Miliseconds, example (2019-11-28T21:24:27.427Z) and  I need to convert to DD/MM/YYYY HH:MM:SS that power bi already creates the data hierarchy format (General Date - 14/03/2001 13:30:55 ).

 

Is there any easy way to perform this conversion?

 

Kind regards!

 

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

Hi  @pforchito ,

 

You can also create a custom column using below M codes to realize it: (Timezone fixed number is based on your current timezone)

Custom.1=DateTimeZone.RemoveZone(DateTimeZone.SwitchZone(DateTime.AddZone(DateTime.From([date]),0),-8))

v-kelly-msft_0-1615518180753.png

 

And you will see:

v-kelly-msft_1-1615518200153.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi  @pforchito ,

 

You can also create a custom column using below M codes to realize it: (Timezone fixed number is based on your current timezone)

Custom.1=DateTimeZone.RemoveZone(DateTimeZone.SwitchZone(DateTime.AddZone(DateTime.From([date]),0),-8))

v-kelly-msft_0-1615518180753.png

 

And you will see:

v-kelly-msft_1-1615518200153.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

edhans
Super User
Super User

Set the type as Date/Time/Zone. That data has the timezone embedded in it. Although for me the data you gave did the conversion to DateTime just fine. But I have seen conversions that require a two step.

First convert to Date/Time/Zone, then convert again and tell Power Query to add a new step.

 

 

edhans_0-1615340369866.png

 

It returns this.

edhans_1-1615340436976.png

 

It might be failing due to your locale settings. If that is the case, this data works using the en-US culture code, so when doing the conversion, select the "Using Locale" when doing the conversion then select US English.

edhans_2-1615340550025.png

If that doesn't work, provide more data in a nice table format per the links below with a screenshot of the error you are getting.

How to get good help fast. Help us help you.

How To Ask A Technical Question If you Really Want An Answer

How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.

 

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors