Bug 220602

Summary: Removing leading zeroes in date output isn't documented
Product: Documentation Reporter: Solène Rapenne <solene+freebsd>
Component: Books & ArticlesAssignee: freebsd-doc (Nobody) <doc>
Status: Closed Not A Bug    
Severity: Affects Many People CC: fk
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

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.