`date -d`可以输入的日期标准是什么?
What are the date standards that can be inputted to `date -d`?
我正在为我编写的 bash 脚本编写 wiki,可选参数之一是将传递到 date -d $DATE
的日期。解释哪些类型的日期格式可以接受的最佳方式是什么?根据手册页以及反复试验,可以接受 07/10/2015 和 20150710,但不能接受 07102015 和 150710。此外,"yesterday" 和“2 天前”等参数也是有效的。是否有描述这些类型的日期格式的总称?
这在很大程度上取决于您的用户是谁。对于有一定经验的用户,the manual:
中的描述
This section describes the textual date representations that GNU
programs accept. These are the strings you, as a user, can supply as
arguments to the various programs.
建议写成 "a date in a format accepted by GNU programs".
我正在为我编写的 bash 脚本编写 wiki,可选参数之一是将传递到 date -d $DATE
的日期。解释哪些类型的日期格式可以接受的最佳方式是什么?根据手册页以及反复试验,可以接受 07/10/2015 和 20150710,但不能接受 07102015 和 150710。此外,"yesterday" 和“2 天前”等参数也是有效的。是否有描述这些类型的日期格式的总称?
这在很大程度上取决于您的用户是谁。对于有一定经验的用户,the manual:
中的描述This section describes the textual date representations that GNU programs accept. These are the strings you, as a user, can supply as arguments to the various programs.
建议写成 "a date in a format accepted by GNU programs".