1.shell获取时间
time1=$(date) echo $time1 time2=$(date "+%Y%m%d%H%M%S") echo $time2 time3=$(date "+%Y-%m-%d %H:%M:%S") echo $time3 time4=$(date "+%Y.%m.%d") echo $time4 # 1. 取今天时间 now=`date -d "now" +%Y-%m-%d` echo $now # 2.取昨天时间 yesterday=`date -d "yesterday" +%Y-%m-%d` echo $yesterday # 3.获取前n天 daysago=`date -d "2 days
近期评论