Forum Discussion
Last Refresh Date change Timezone
- 4 years ago
lkshck , I think you should use
Date.From(DateTime.FixedLocalNow())
for timezone refer if this can help
None of the above solutions worked well for my scenario. I ended up implementing the solution below, which seems to be working fine. In short, I get the time in UTC, add/subtract the duration necessary to set that to my desired timezone (it's AEST in my case), use the RemoveZone method and finally convert to a datetime column.
This is the PowerQuery code for creating a table, with a single column which contains the datetime of the last refresh and that shows the same value in both Desktop and in the workspace:
let
Source = DateTimeZone.RemoveZone( DateTimeZone.UtcNow() + #duration(0, 10, 0, 0) ), //AEST is UTC+10
#"Converted to Table" = #table(1, {{Source}}),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Refresh_AEST"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Refresh_AEST", type datetime}})
in
#"Changed Type"