[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#72023: feature request for date(1): strptime-style format
From: |
Stephane Chazelas |
Subject: |
bug#72023: feature request for date(1): strptime-style format |
Date: |
Tue, 10 Sep 2024 06:57:45 +0100 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#72023: feature request for date(1): strptime-style format,
Stephane Chazelas <=