[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Date doesn't accept its own ISO format date
From: |
Jon. Hallett |
Subject: |
Re: Date doesn't accept its own ISO format date |
Date: |
Wed, 27 Jun 2001 14:40:43 +0100 |
At 11:27 27/06/2001 +0100, Jon. Hallett wrote:
Folks,
Not critical, but the date command's --date option won't accept date's own
ISO formatted output:
login[~]> date --date="`date --iso-8601=seconds`"
date: invalid date `2001-06-27T12:21:43+0100'
Have a patch:
*** sh-utils-2.0/lib/getdate.y~ Sat Aug 7 10:39:05 1999
--- sh-utils-2.0/lib/getdate.y Wed Jun 27 14:33:39 2001
***************
*** 310,315 ****
--- 310,325 ----
yyMonth = -$2;
yyDay = -$3;
}
+ | tUNUMBER tSNUMBER tSNUMBER tZONE {
+ /* ISO 8601 format. yyyy-mm-ddT. */
+ /* it's a bad pun, but a T is lexed as a -0700 timezone. */
+ if ($4 != HOUR(-7)) {
+ return 1;
+ }
+ yyYear = $1;
+ yyMonth = -$2;
+ yyDay = -$3;
+ }
| tUNUMBER tMONTH tSNUMBER {
/* e.g. 17-JUN-1992. */
yyDay = $1;
Jon.