Forum Discussion
Easy consistent Last Refresh Time (your local time zone) solution - no matter how refreshed
- 10 years ago
Thanks for your sharing. That's a awesome idea to indicate a precise refresh time. :)
Just some tips, no need to import the web as a source, the Power Query,also known as "M", has a "DateTimeZone.UtcNow()", you can get UTC time with that function and tweak different timezones based on UTC.
Thanks for your sharing. That's a awesome idea to indicate a precise refresh time. :)
Just some tips, no need to import the web as a source, the Power Query,also known as "M", has a "DateTimeZone.UtcNow()", you can get UTC time with that function and tweak different timezones based on UTC.
- Virtual_Ames10 years agoMicrosoft Employee
Excellent. Thanks.
Question though - let's say I want the timestamp value to always reflect the timezone of the user who is generating the report. Is there a way to set that up using M? That would go one step beyond the current solution we have on the table.Brian
- Eric_Zhang10 years agoMicrosoft Employee
Add a custom column in Query Editor. The 8 refers to timezone offset, it always shows the local time of +08:00 timezone.
DateTimeZone.UtcNow()+#duration(0, 8, 0, 0)
If it can achieve your goal, please accept it as solution.:) For any question, feel free to let me now.
- pkoetzing6 years agoAdvocate III
Switching timezones in M-language has a very limited functionallity, as you can switch by a given number of hours only. But this doesn't help when you're located in a daylight savings regime. Pulling the proper timestamp from an external API is unfortunately still the only working solution. I'd recommend using worldtimeapi.org and e.g. the following script:
let Source = Json.Document( Web.Contents("http://worldtimeapi.org/api/timezone/Europe/Berlin")), #"Converted to Table" = Record.ToTable(Source), #"Filtered Rows" = Table.SelectRows( #"Converted to Table", each ([Name] = "datetime")), #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Name"}), #"Changed Type" = Table.TransformColumnTypes( #"Removed Columns",{{"Value", type datetimezone}}), #"Renamed Columns" = Table.RenameColumns( #"Changed Type",{{"Value", "Europe/Berlin"}}) in #"Renamed Columns" - Virtual_Ames10 years agoMicrosoft Employee
Thanks - this is very helpful.
Appreciated.
Brian
- Anonymous4 years agoNot applicable
What should we do with the daylight saving time (DST)?
For example the difference between Melbourne time can be +10, but the other six month it is +11.
Any automatic solution for this?
Thanks