As shown below:
#!/bin/bash #1 month agohistoryTime=$(date "+%Y-%m-%d %H" -d '1 month ago') echo ${historyTime} historyTimeStamp=$(date -d "$historyTime" +%s) echo ${historyTimeStamp} #A week ago$(date "+%Y-%m-%d %H" -d '7 day ago') #January 1 this monthdate_this_month=`date +%Y%m01` #One day agodate_today=`date -d '1 day ago' +%Y%m%d` #One hour ago$(date "+%Y-%m-%d %H" -d '-1 hours')
The above article is obtained from the previous month, weekly time and timestamp range examples are all the content I have shared with you. I hope you can give you a reference and I hope you can support me more.