Try using my solution with sed + awk:
echo $DateStart | sed 's/:\|-/ /g;' | awk '{print $4" "$3" "$2" "$1}' | awk '{print $1+$2*60+$3*3600+$4*86400}' echo $DateEnd | sed 's/:\|-/ /g;' | awk '{print $4" "$3" "$2" "$1}' | awk '{print $1+$2*60+$3*3600+$4*86400}'
it breaks the string into sed, then inverts the numbers back ("DD hh mm ss" → "ss mm hh DD") and computes them using awk. It works even after adding days: [[DD-] hh:] mm: ss, for example:
34:56 12:34:56 123-12:34:56
source share