`date` command on OS X doesn't have ISO 8601 `-I` option?

后端 未结 9 1522

In a Bash script, I want to print the current datetime in ISO 8601 format (preferably UTC), and it seems that this should be as simple as date -I:

http://ss

9条回答
  •  爱一瞬间的悲伤
    2021-01-29 19:50

    I regularly use 'date -I' in Linux when saving files. ex: touch x.date -I. While the equivalent in MacOS is 'date +%F', it is a bit awkward to type every time I save a file. So, I set an alias "alias dt='date +%F'" then touch x.dt gives me the date.

提交回复
热议问题