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.
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"