Forum Discussion
Extracting total seconds from timestamps
Good Day all,
I need some assistance if possible.
I am currently doing a calculation of time elapsed based between events on time stamps. The system stamps a change in event using the Unix time stamp. I did some table merging and some of the associated values return a null value (this is not the problem). What I want to achieve is to replace those nulls values with the local time so as to substract the local time from the time stamp.
I used the following M function with no success:
Table.ReplaceValue(#"Expanded NewColumn2",null,Duration.TotalSeconds(Duration.From(DateTime.FromFileTime)),Replacer.ReplaceValue,{"NewColumn.system_time"}).
Please help!
Regards,
Abdul
AbdulAzizAmod wrote:
Good Day all,
I need some assistance if possible.
I am currently doing a calculation of time elapsed based between events on time stamps. The system stamps a change in event using the Unix time stamp. I did some table merging and some of the associated values return a null value (this is not the problem). What I want to achieve is to replace those nulls values with the local time so as to substract the local time from the time stamp.
I used the following M function with no success:
Table.ReplaceValue(#"Expanded NewColumn2",null,Duration.TotalSeconds(Duration.From(DateTime.FromFileTime)),Replacer.ReplaceValue,{"NewColumn.system_time"}).
Please help!
Regards,
Abdul
Try
Table.ReplaceValue(#"Expanded NewColumn2",null,Duration.TotalSeconds(Duration.From(DateTime.LocalNow()-#datetime(1970,01,01,0,0,0))),Replacer.ReplaceValue,{"NewColumn.system_time"})and it shall work.
1 Reply
- Eric_Zhang
Microsoft Employee
AbdulAzizAmod wrote:
Good Day all,
I need some assistance if possible.
I am currently doing a calculation of time elapsed based between events on time stamps. The system stamps a change in event using the Unix time stamp. I did some table merging and some of the associated values return a null value (this is not the problem). What I want to achieve is to replace those nulls values with the local time so as to substract the local time from the time stamp.
I used the following M function with no success:
Table.ReplaceValue(#"Expanded NewColumn2",null,Duration.TotalSeconds(Duration.From(DateTime.FromFileTime)),Replacer.ReplaceValue,{"NewColumn.system_time"}).
Please help!
Regards,
Abdul
Try
Table.ReplaceValue(#"Expanded NewColumn2",null,Duration.TotalSeconds(Duration.From(DateTime.LocalNow()-#datetime(1970,01,01,0,0,0))),Replacer.ReplaceValue,{"NewColumn.system_time"})and it shall work.