GNU bug report logs - #29589
date %k adds extra space for single digits hours

Previous Next

Package: coreutils;

Reported by: Noam Arad <noam.arad <at> kaltura.com>

Date: Wed, 6 Dec 2017 16:39:01 UTC

Severity: normal

Tags: notabug

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29589 in the body.
You can then email your comments to 29589 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#29589; Package coreutils. (Wed, 06 Dec 2017 16:39:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Noam Arad <noam.arad <at> kaltura.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 06 Dec 2017 16:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Noam Arad <noam.arad <at> kaltura.com>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Subject: date %k adds extra space for single digits hours
Date: Wed, 6 Dec 2017 09:17:12 +0000
[Message part 1 (text/plain, inline)]
When using date command with the format %k if the hour is single digits there is an extra space added.
E.g.: date -u +"%Y/%m/%d %k:%M:%S" when run at "2017/12/06 9:16:26" will give the output "2017/12/06  9:16:26"
NOTE: there are two spaces between "06" and "9".

Thanks
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#29589; Package coreutils. (Wed, 06 Dec 2017 16:50:02 GMT) Full text and rfc822 format available.

Message #8 received at 29589 <at> debbugs.gnu.org (full text, mbox):

From: Bishop Bettini <bishop.bettini <at> gmail.com>
To: Noam Arad <noam.arad <at> kaltura.com>
Cc: 29589 <at> debbugs.gnu.org
Subject: Re: bug#29589: date %k adds extra space for single digits hours
Date: Wed, 6 Dec 2017 11:49:07 -0500
[Message part 1 (text/plain, inline)]
On Wed, Dec 6, 2017 at 4:17 AM, Noam Arad <noam.arad <at> kaltura.com> wrote:

> When using date command with the format %k if the hour is single digits
> there is an extra space added.
> E.g.: date -u +"%Y/%m/%d %k:%M:%S" when run at "2017/12/06 9:16:26" will
> give the output "2017/12/06  9:16:26"
> NOTE: there are two spaces between "06" and "9".
>

This seems expected. Per the documentation as of GNU coreutils 8.22:

       %k     hour, space padded ( 0..23); same as %_H

This is just a pass-thru to strftime under the hood, whose documentation
says:

       %k     The hour (24-hour clock) as a decimal number (range 0 to
23);  single  digits  are  preceded  by  a
              blank.  (See also %H.)  (Calculated from tm_hour.)  (TZ)

To format without the space, use %-k:

$ TZ=America/Whitehorse date +'%k'
 8
$ TZ=America/Whitehorse date +'%-k'
8
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#29589; Package coreutils. (Wed, 06 Dec 2017 18:56:02 GMT) Full text and rfc822 format available.

Message #11 received at 29589 <at> debbugs.gnu.org (full text, mbox):

From: Noam Arad <noam.arad <at> kaltura.com>
To: Bishop Bettini <bishop.bettini <at> gmail.com>
Cc: "29589 <at> debbugs.gnu.org" <29589 <at> debbugs.gnu.org>
Subject: RE: bug#29589: date %k adds extra space for single digits hours
Date: Wed, 6 Dec 2017 18:55:01 +0000
[Message part 1 (text/plain, inline)]
Thanks for the quick reply.
Will use your suggestions.

Noam

From: Bishop Bettini [mailto:bishop.bettini <at> gmail.com]
Sent: Wednesday, December 6, 2017 6:49 PM
To: Noam Arad <noam.arad <at> kaltura.com>
Cc: 29589 <at> debbugs.gnu.org
Subject: Re: bug#29589: date %k adds extra space for single digits hours

On Wed, Dec 6, 2017 at 4:17 AM, Noam Arad <noam.arad <at> kaltura.com<mailto:noam.arad <at> kaltura.com>> wrote:
When using date command with the format %k if the hour is single digits there is an extra space added.
E.g.: date -u +"%Y/%m/%d %k:%M:%S" when run at "2017/12/06 9:16:26" will give the output "2017/12/06  9:16:26"
NOTE: there are two spaces between "06" and "9".

This seems expected. Per the documentation as of GNU coreutils 8.22:

       %k     hour, space padded ( 0..23); same as %_H

This is just a pass-thru to strftime under the hood, whose documentation says:

       %k     The hour (24-hour clock) as a decimal number (range 0 to 23);  single  digits  are  preceded  by  a
              blank.  (See also %H.)  (Calculated from tm_hour.)  (TZ)

To format without the space, use %-k:

$ TZ=America/Whitehorse date +'%k'
 8
$ TZ=America/Whitehorse date +'%-k'
8

[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#29589; Package coreutils. (Tue, 30 Oct 2018 02:17:01 GMT) Full text and rfc822 format available.

Message #14 received at 29589 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
Cc: "29589 <at> debbugs.gnu.org" <29589 <at> debbugs.gnu.org>
Subject: Re: bug#29589: date %k adds extra space for single digits hours
Date: Mon, 29 Oct 2018 20:16:16 -0600
tags 29589 notabug
close 29589
stop

(triaging old bugs)

From: Bishop Bettini [mailto:bishop.bettini <at> gmail.com]
> On Wed, Dec 6, 2017 at 4:17 AM, Noam Arad  wrote:
> When using date command with the format %k if the hour is single digits there is an extra space added.
> E.g.: date -u +"%Y/%m/%d %k:%M:%S" when run at "2017/12/06 9:16:26" will give the output "2017/12/06  9:16:26"
> NOTE: there are two spaces between "06" and "9".
> 
> This seems expected. Per the documentation as of GNU coreutils 8.22:
> 
>         %k     hour, space padded ( 0..23); same as %_H
> 

On 2017-12-06 11:55 a.m., Noam Arad wrote:
> Thanks for the quick reply. Will use your suggestions.
Given the above, I'm closing this bug.
Discussion can continue by replying to this thread.

-assaf





Added tag(s) notabug. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 30 Oct 2018 02:17:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 29589 <at> debbugs.gnu.org and Noam Arad <noam.arad <at> kaltura.com> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 30 Oct 2018 02:17:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 27 Nov 2018 12:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 145 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.