Hi, i am having issues converting the time in Unix time (60*60*24) to date time.
but i couldnt get it to work. i have the values like the attached in first picture. Please help me convert this number to datetime.
Solved! Go to Solution.
Old thread, but I was able to solve the time zone issue by adding a bit of code to add a GMT timezone and convert that to local time.
DateTimeZone.ToLocal(DateTime.AddZone(#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [YOUR DATETIME COLUMN]/1000),0))
Thanks for the post, i got it to work for my data. Only one point was that the unit time I had was unix time in s not ms, so I didn't need the /1000. I think unix time is quite common in both formats.
Adjust the formula with -6 as hours in the #duration part:
#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, -6, 0, [UnixTime]/1000)
First thanks for all the people posting in this thread it's been a great help.
However I've got a timezone issue. The MySQL server sits on a box that uses UTC (provided by a supplier so no control for me) I am pulling in the data by selecting the table and it comes to sit on a UK environment/users which twice a year has it's timezone change.
I'm wondering if there is a way to use this code to adapt based on whether GMT is +1 or not in PowerBI.
If not I'll need to figure out how to do it on MySQL and use SQL command to get the data instead. Just preferred to solve it in PowerBi if I can.
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.
130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.