日期(Linux):
TODAY=`date +%Y%m%d`
YESTERDAY=`date -d'-1 day' +%Y%m%d`
LAST_MONTH=`date -d'-1 month' +%Y%m%d`


日期(bsd):
YESTERDAY=`date -v-1d +%Y%m%d`

 

部落小波 的提醒:

PS. gnu date 才有這些特異功能

solaris, hp-unix, aix 應該是沒有 -1 d 這種東東

arrow
arrow
    全站熱搜

    Ching-Wei 發表在 痞客邦 留言(0) 人氣()