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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
alitzellachner
Frequent Visitor

Local to UTC conversion (summer/ winter time)

Hy,

another question for time appeared. I'm converting local to UTC time with summer/ winter time which works. At the end i make a text by

startdate= DateTime.ToText(convertLOCALtoUTCWithDST(start), "yyyy-MM-ddThh:mm:ssZ")

 

In the result he clears am/pm so 08:00 in the morning is the same as 20:00. Is there any solution for this?

 

Thank you,

Andreas

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @alitzellachner ,

Please try replacing "hh" with "HH":

startdate = DateTime.ToText(convertLOCALtoUTCWithDST(start), "yyyy-MM-ddTHH:mm:ssZ")

vcgaomsft_0-1689928688267.png

Custom date and time format strings | Microsoft Learn

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @alitzellachner ,

Please try replacing "hh" with "HH":

startdate = DateTime.ToText(convertLOCALtoUTCWithDST(start), "yyyy-MM-ddTHH:mm:ssZ")

vcgaomsft_0-1689928688267.png

Custom date and time format strings | Microsoft Learn

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

alitzellachner
Frequent Visitor

thx but in this case i get the same result "2023-03-01T06:00:00Z" and no distinction between summer and winter time. So the problem is the transformation ToText

 

start= 01.03.2023 20:00:00 +02:00

= DateTimeZone.ToText(DateTimeZone.ToUtc(start), "yyyy-MM-ddThh:mm:ssZ")

Vijay_A_Verma
Super User
Super User

I think you can directly use DateTimeZone.ToUtc or DateTimeZone.ToText

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors