Add month to a variable date in shell script

强颜欢笑 提交于 2019-12-01 22:44:01

You seem to be looking for:

date -d "20170601+1 month" +%Y-%m-%d

When using multiple -d flags in the same command, date seems to only use the last one.

And of course, feel free to replace 20170601 by $VAR containing any date.

For macOS High Sierra

date -v+1m -j -f "%Y-%m-%d" "2017-06-01"
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!