help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem printing 24 hour times OR a stupid mistake


From: Chris Elvidge
Subject: Re: Problem printing 24 hour times OR a stupid mistake
Date: Sun, 9 Jan 2022 15:40:56 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 Lightning/5.4

On 09/01/2022 15:22, Greg Wooledge wrote:
On Sun, Jan 09, 2022 at 08:13:25AM -0600, Dennis Williamson wrote:
You should be able to omit the printf and just do

date -d"$tim12" +"%H%M"

  9. All examples given by the questioner will be broken, misleading,
     wrong, incomplete, and/or not representative of the actual question.


Or did they think that date +%H might sometimes give a single-digit number,
and then they needed to zero-pad that to two digits?  That's a false
assumption.  date +%H is guaranteed to give two digits of output, never
one digit.  No additional padding is required.


That was exactly the misconception on my part. I should read more manuals.

--
Chris Elvidge
England




reply via email to

[Prev in Thread] Current Thread [Next in Thread]