Print the DATE in ISO format.(MAC OS CATALINA / BASH)

date +%Y-%m-%dT%H:%M:%S%z
Print date in iso format. Created and tested on MAC OS CATALINA. Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64 bash
Sample Output
2019-10-13T15:49:45+0200
2019-10-13T15:51:31+0200

0
2019-10-13 13:49:58

What Others Think

The GNU coreutils date command has a built-in ISO function: -I. You can specify the granularity of it with hours, minutes, seconds, or ns. Save yourself some typing. E.g. date -Iseconds 2019-11-13T16:27:41-0500
vicgedris · 3 weeks and 2 days ago
Thanks for the advice. I forgot to write is for MAC OS X. The option "date -I seconds" no exist. date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format] Regards, ThinWarrior
ThinWarrior · 4 days ago
Ehrm... date +%FT%T%z ??
ruurd · 4 days ago
There is no gnu coreutils on macOS
ruurd · 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: