Bug 220602 - Removing leading zeroes in date output isn't documented
Summary: Removing leading zeroes in date output isn't documented
Status: Closed Not A Bug
Alias: None
Product: Documentation
Classification: Unclassified
Component: Books & Articles (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-doc (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-10 13:44 UTC by Solène Rapenne
Modified: 2017-07-12 16:02 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Solène Rapenne 2017-07-10 13:44:35 UTC
Hello,

The output of `date "+%m"` in july is "07". It is possible to remove the leading zero by using the following syntax `date "+%-m"` which will output "7".

I haven't been able to find this in date(1), strftime(3), strptime(3).

I found it by looking gnu date man page and trying it on FreeBSD.
Comment 1 Fabian Keil 2017-07-12 11:34:57 UTC
This is documented in strftime(3) which is referenced by date(1):

| %-*   GNU libc extension.  Do not do any padding when performing
|          numerical outputs.
Comment 2 Solène Rapenne 2017-07-12 16:02:30 UTC
(In reply to Fabian Keil from comment #1)

Sorry for the fuss.