Forum Discussion
Problem Converting UNIX time power bi desktop
- 7 years ago
Hi Shubs,
The "2" is the adjustment of daylight savings. It should be the below one in your scenario. The time saving is an interval. You can adjust it yourself.
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Custom", each if Date.Month(#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [UnixTime]/1000)) >= 11 then #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 5, 0, [UnixTime]/1000) else #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 4, 0, [UnixTime]/1000)),
Best Regards,
Dale - 7 years ago
Hi Shubs,
I don't know the other boundary. That's why I asked you to adjust it. I assume it is April. It should be this one.
if Date.Month(#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [UnixTime]/1000)) >= 11
or Date.Month(#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [UnixTime]/1000)) <= 4
then #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 5, 0, [UnixTime]/1000)
else #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 4, 0, [UnixTime]/1000)Best Regards,
Dale
Thanks for clearing this. Just one quick one, that day saving hours changes with time( presently 4 hours and after november it will be 5 hours ), So do this formula work fine then as well ?
Also, Can you please explain the logic of '2' below :
#duration(0, 2, 0, [UnixTime]/1000)
Thanks for the help. I appreciate your efforts.
Thanks
Shubs
Hi Shubs,
The "2" is the adjustment of daylight savings. It should be the below one in your scenario. The time saving is an interval. You can adjust it yourself.
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Custom", each if Date.Month(#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [UnixTime]/1000)) >= 11 then #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 5, 0, [UnixTime]/1000) else #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 4, 0, [UnixTime]/1000)),
Best Regards,
Dale
- Anonymous7 years agoNot applicable
- Anonymous7 years agoNot applicable
each if Date.Month(#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [UnixTime]/1000)) >= 11
This will take the 5 hour day saving hours for just November and December only.. Not Jan, Feb or march ?
As the the month number will be less than 11 ?
Are you understanding the above thing ?
Thanks
Shubs- v-jiascu-msft7 years agoMicrosoft Employee
Hi Shubs,
I don't know the other boundary. That's why I asked you to adjust it. I assume it is April. It should be this one.
if Date.Month(#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [UnixTime]/1000)) >= 11
or Date.Month(#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [UnixTime]/1000)) <= 4
then #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 5, 0, [UnixTime]/1000)
else #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 4, 0, [UnixTime]/1000)Best Regards,
Dale- Anonymous7 years agoNot applicable