This answer and comments mention --rfc-3339 and a "hidden" --iso-8601 option that I have used for a long time and now seems to be undocumented.

When did that option documentation get removed from the --help text?

Will the option go away anytime soon?

  • 1
    To get this feature on OSX I finally got the GNU tools: $ brew install coreutils ; gdate --iso-8601 -d "yesterday 12:00" – AnneTheAgile Jul 5 '18 at 18:51
  • 8
    @AnneTheAgile for macOS, you can manually format the date like so: "date +%Y-%m-%dT%H:%M:%S%z" – Bart Doe Apr 23 '19 at 12:47

The option was introduced in the coreutils date (which is probably what you have) in 1999 (Apr. 8).

The documentation was removed in 2005 without much explanation in the commit.

In 2011, the help for --iso-8601 was reintroduced with the following explanation:

We deprecated and undocumented the --iso-8601 (-I) option mostly
because date could not parse that particular format.  Now that
it can, it's time to restore the documentation.
* src/date.c (usage): Document it.
* doc/coreutils.texi (Options for date): Reinstate documentation.
Reported by Hubert Depesz Lubaczewski in http://bugs.gnu.org/7444.

It looks like the help was taken out in version 5.90 and put back in, in version 8.15 (it is not in my 8.13) and the comment above suggests that it is now back to stay and not likely to be disappearing any time soon.

|improve this answer|||||

The --help got an update recently actually, so the option definitely isn't going away:

-I[FMT], --iso-8601[=FMT]  output date/time in ISO 8601 format.
                             FMT='date' for date only (the default),
                             'hours', 'minutes', 'seconds', or 'ns'
                             for date and time to the indicated precision.
                             Example: 2006-08-14T02:34:56-06:00

     -R, --rfc-2822        output date and time in RFC 2822 format.
                             Example: Mon, 14 Aug 2006 02:34:56 -0600

         --rfc-3339=FMT    output date/time in RFC 3339 format.
                             FMT='date', 'seconds', or 'ns'
                             for date and time to the indicated precision.
                             Example: 2006-08-14 02:34:56-06:00

Note since coreutils-8.27 --rfc-2822 is deprecated in favor of the more general --rfc-email

     -R, --rfc-email       output date and time in RFC 5322 format.
                             Example: Mon, 14 Aug 2006 02:34:56 -0600
|improve this answer|||||
  • 2
    It would be nice if there was a -I style without the timezone. Would be more useful for logging, etc, where the timezone doesn't matter – naught101 Jan 17 '19 at 5:56

I'm running Linux Mint and the option is available:

$ lsb_release -a
No LSB modules are available.
Distributor ID: LinuxMint
Description:    Linux Mint 17.3 Rosa
Release:    17.3
Codename:   rosa

The execution of the command:

$echo $(date --iso-8601=seconds)
|improve this answer|||||
  • 5
    or just date -Iseconds – pstanton Nov 15 '19 at 1:29
  • 1
    but it doesn't appends Z to the end so this is not fully complete ISO timestamp – Sergey Ponomarev Jan 7 at 10:34
  • That's the closest I could get with available parameters – alfredocambera Jan 8 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.