Nov 11 2020 01:24 PM
I have configured a source in Power Query Editor to import data in which the times are in UTC milliseconds. See sample below.
This results in Power Query converting this to scientific notation. See sample below.
I have attempted creating a Custom Column using various formulas that I have found but they have only resulted in 'Error' messages.
Is there a way to prevent this conversion to scientific notation during import? Or, once imported, a formula that can be used to convert this to a readable date format?
Nov 12 2020 12:55 PM
To convert from Unix time, which is number of milliseconds (in your case , could be seconds) from start of 01 Jan 1700 UTC
to common one
you may use something like
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
ReplaceStart = Table.ReplaceValue(
Source,
each [Start],
each #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [Start]/1000),
Replacer.ReplaceValue,{"Start"}
),
ReplaceEnd = Table.ReplaceValue(
ReplaceStart,
each [End],
each #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [End]/1000),
Replacer.ReplaceValue,{"End"}
)
in
ReplaceEnd
To adjust time zone use second parameter in #duration(), e.g. -3 for UTC-3