GNU bug report logs -
#72023
feature request for date(1): strptime-style format string when you don't want date to guess
Previous Next
Full log
View this message in rfc822 format
I agree strptime()-style input format specification is badly
missing in GNU date. Most other implementations support it:
- BSD with -f since 1997 (on FreeBSD at least; see also -v for adjustments)
- ast-open's with -p since 2004 (also via standard getdate() DATEMSK)
- busybox' with -D since 2006
- toybox' with -D since 2014
It's a regular occurrence on usenet or unix.stackexchange.com to
see it mentioned that if you need to parse arbitrary date
formats, you need to switch to another date implementation or
use shell builtin facilities such as zsh's strftime builtin or
ksh93's printf %T or resort to perl/ruby/python...
Assaf Gordon did propose a patch in
https://lists.gnu.org/archive/html/coreutils/2019-07/msg00053.html
Both -p and -D are unassigned ATM AFAICT so could be used here.
busybox and toybox mostly copied the GNU API, so it would make
sense for GNU date to use -D for that so they don't become
misaligned.
While strptime() is not perfect, it's still better IMO
than having to rely on the current -d behaviour which mostly
accepts only US-English time specs and whose rules to parse
times are not crystal clear.
--
Stephane
This bug report was last modified 278 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.