How to get the first day of last month, and the last day of last month in bash


DATE_FROM=`date -d "-1 month -$(($(date +%d)-1)) days" "+%F"`
DATE_TO=`date -d "-$(($(date +%d)-1)) days" "+%F"`

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>