What\'s an easy way to convert 00:20:40.28
(HH:MM:SS) to seconds with a Bash script?
Split seconds can be cut out, it’s not essential.
You can convert minutes to hour, seconds, or minutes with bc
command.
By example:
How many minutes for 1000 sec ?
$ echo 'obase=60;1000' | bc
02 00
then -> 2 min
How much hour for 375 min ?
$ echo 'obase=60;375'| bc
06 15
then -> 06h15
How days for 56 hours?
$ echo 'obase=24;56' | bc
02 08
then 02 days and 08 hours
bc with obase is extra!