您的位置:首页 > 大数据 > 人工智能

Get the date of the days before today on AIX

2015-09-10 00:00 381 查看
The date command in AIX doesn't support "-d" switch.
So it is not easy to get the date of the days before (or after) today.

After research, I think it is best to use perl to compute the date we want.

Here it is:

#!/usr/bin/env sh
DAYS=-5
DATE=`DAYS=$DAYS perl -MPOSIX -le 'print strftime("%Y%m%d", localtime(time() + $ENV{'DAYS'} *24 *60 *60))'`

#echo $DATE
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  AIX date perl