Skip to content

Commit 17c8f78

Browse files
authored
date: too much whitespace for %e format (#987)
* I was tracking why the Perl date command separated Mar and 14 with 2 spaces instead of one * The default strftime() format string is "%a %b %e %T %Z %Y" * The Linux manual for strftime() says %e is the same as %d, except that a leading zero is replaced with a leading space * So day 1 would be "01" and " 1", but day 10 would have no leading space/zero * Formatting the day number with "%2d" is good enough for %e specifier; previously day 14 was formatted as " 14" in setup_specifiers() %perl date # with patch Fri Mar 14 09:11:30 AWST 2025 %date # GNU Fri Mar 14 09:11:31 AM AWST 2025
1 parent 8d60ea1 commit 17c8f78

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/date

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ sub select_format {
103103

104104
sub setup_specifiers {
105105
my %specifiers = (
106-
'e' => sprintf( '% 2d', (core_time)[3] ),
106+
'e' => sprintf( '%2d', (core_time)[3] ),
107107
'P' => lc(POSIX::strftime('%p', core_time())),
108108
'q' => quarter(),
109109
'T' => sprintf( '%02d:%02d:%02d', (core_time)[2,1,0] ),

0 commit comments

Comments
 (0)