Get the Date/Time in ISO 8601 Format on the CLI
date command on Linux makes it easy to generate the current timestamp in the ISO 8601 format, suitable for plugging into, say, HTML metadata, or an Eleventy template. But I keep forgetting the command-line options!
(That’s a capital
I telling it to use ISO-8601, and a lower-case
s telling it to include the current time down to the nearest second.)
Update: Hank G. points out that the command on macOS is also simple, but the options are slightly different. On a Mac you have to type:
Update 2: I’ve confirmed that, as expected, FreeBSD uses the same syntax as macOS. Or vice versa, I suppose!