Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 Lightning/5.4
Given tim12="7:00 am" and tim24=$(date -d"$tim12" +"%H%M")
printf '%04d' "$tim24" prints 0488; '%04o' will output 0700
But if tim12="7:00 pm" and tim24=$(date -d"$tim12" +"%H%M")
'%04d' gives the correct output 1900 but '%04o' gives 3554
I have got round the problem with tim24=$(date -d"$tim12" +"%-H%M") i.e.
stripping leading zeros, but is there any way to force printf to
recognise 0700 as a decimal number?