- 论坛徽章:
- 93
|
查看date帮助的时候发现这个格式输出的是“世纪”:
- %C century; like %Y, except omit last two digits (e.g., 20)
复制代码 但印象觉得世纪是年份除以一百加一,搜索确认了确实是呀,所以测试了一下,这个 %C 真的没有加一:
- [seesea@UC ~]$ date +"%Y %C" -d "1999-10-20"
- 1999 19
- [seesea@UC ~]$ date +"%Y %C" -d "2000-10-20"
- 2000 20
- [seesea@UC ~]$ date +"%Y %C" -d "2001-10-20"
- 2001 20
复制代码 难道版本太老没发现这个bug么?还是我对世纪的理解不对?
- [seesea@UC ~]$ date --version
- date (GNU coreutils) 8.4
- Copyright (C) 2010 Free Software Foundation, Inc.
- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
- This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law.
- Written by David MacKenzie.
复制代码 查了单词century除了世纪还有百年的意思,这里用百年来解释应该不是很贴切吧? |
|