Forum Discussion
IPGeorgiev
Helper III
6 years agoConvert HH:MM:SS to seconds
Hi All, I have the following column in my table: 434:03:22 434:03:22 167:44:05 167:44:05 155:00:37 155:00:37 140:34:43 140:34:43 119:35:42 119:35:42 97:04:53 ...
- 6 years ago
Hi IPGeorgiev,
To avoid having to split the column by delimeter in the case you aren't sure of the length of each string being consistent always you can apply the same methods but using a combination of Text.BeforeDelimeter, Text.AfterDelimeter and Text.BetweenDelimeter M functions.
Number.FromText( Text.BeforeDelimiter( [Time], ":" ) ) * 3600 + Number.FromText( Text.BetweenDelimiters( [Time], ":", ":", 0, 0 ) ) * 60 + Number.FromText( Text.AfterDelimiter( [Time], ":", 1 ) )Hope it helps.
Kris
kriscoupe
Solution Supplier
6 years agoHi IPGeorgiev,
To avoid having to split the column by delimeter in the case you aren't sure of the length of each string being consistent always you can apply the same methods but using a combination of Text.BeforeDelimeter, Text.AfterDelimeter and Text.BetweenDelimeter M functions.
Number.FromText( Text.BeforeDelimiter( [Time], ":" ) ) * 3600
+
Number.FromText( Text.BetweenDelimiters( [Time], ":", ":", 0, 0 ) ) * 60
+
Number.FromText( Text.AfterDelimiter( [Time], ":", 1 ) )
Hope it helps.
Kris
IPGeorgiev
Helper III
6 years agoAwesome!!! Many many thanks for the support!