比如今日是2012-04-22
$ date -d "+1 day" +%Y-%m-%d
2012-04-23
 
$ date -d "-1 day" +%Y-%m-%d
2012-04-21
 
$ date -d "2012-04-10 -1 day " +%Y-%m-%d
2012-04-09
 
$ date -d "2012-04-10 +1 day " +%Y-%m-%d
2012-04-11
 
$ date -d "-1 week " +%Y-%m-%d
2012-04-15
 
$ date -d "+1 week " +%Y-%m-%d
2012-04-29
 
$ date -d "+1 month " +%Y-%m-%d
2012-05-22
 
$ date -d "-1 month " +%Y-%m-%d
2012-03-22
 
$ date -d "-1 year " +%Y-%m-%d
2011-04-22
 
$ date -d "+1 year " +%Y-%m-%d
2013-04-22
 
 
文章转自于:http://zgysc.blog.163.com/blog/static/42370520201383094911499/
posted on 2015-06-01 10:09  知识天地  阅读(3084)  评论(0编辑  收藏  举报