Issue
I would like to convert times into seconds aka:
00:25:56 = 25 * 60 + 56 = 1556
01:00:00 = 1 * 60 * 60 = 3600
I had been using: date -d$element +%s
but this of course returns the current date and time in seconds.
Solution
Simply specify the starting date of Unix time (also known as "Epoch") in the UTC time zone (shorthand Z
):
time=00:24:56
date -d "1970-01-01 $time Z" +%s
# prints 1496
Answered By - Socowi