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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
EaglesTony
Post Prodigy
Post Prodigy

Changing type to date is causing date to go to next day

Hi,

 

  I have this data coming in:

EaglesTony_0-1731074781937.png

 

  When I change the type to "Date", it shows me 11/18/2024 instead of 11/19/2024 ???

EaglesTony_1-1731074847998.png

 

1 ACCEPTED SOLUTION

Looking at it another way, it DOES take into account your region settings. The original is of type datetimezone and the +00:00 indicates it is UTC. When you convert it to type date, it changes it to the date in your local timezone. For END_DATE that happens to be the previous day. 

 

How to handle this depends on what you are trying to accomplish. If you want to keep the Date part the same as if you were using UTC, then you can remove the timezone information.

View solution in original post

10 REPLIES 10
Omid_Motamedise
Super User
Super User

it is because of time zoon. your value is in time zoon + 00:00 and when you convert it into date your time zoon will be added into it.


EaglesTony
Post Prodigy
Post Prodigy

Keep it UTC how ?...This data is coming from another system...is there a way I could adjust it back 5 hours ?

Yes, Power Query offers functions to add, remove, or change timezones. 

 

Converting a datetimezone to date will recalculate the date.  Removing the timezone first will not recalculate the date.

 

You can choose which way to do this.

EaglesTony
Post Prodigy
Post Prodigy

I am in the Eastern Time Zone.

That would explain it.

 

What is your expected result? And why?

lbendlin
Super User
Super User

You seem to live in a timezone west of Greenwich? (But not that much, less than 20 hrs)

So your saying, since I am 5 hours behind, PowerBI doesn't take into account my region settings(EST) and changes it back 5 hours (in this case would be 11/18/2024 11pm, I assume) ?

Looking at it another way, it DOES take into account your region settings. The original is of type datetimezone and the +00:00 indicates it is UTC. When you convert it to type date, it changes it to the date in your local timezone. For END_DATE that happens to be the previous day. 

 

How to handle this depends on what you are trying to accomplish. If you want to keep the Date part the same as if you were using UTC, then you can remove the timezone information.

Yes, I just want to keep the date part.

 

This is the solution:

 

1) First remove the timezone using DateTimeZone.RemoveZone 

2) Convert it to a Date 

correct.  Stuff like this is the main reason why everything should be kept in UTC.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.