shell - how to calculate the total minutes between two dates? -
this question has answer here:
can me calculate total minutes between below 2 dates.
date1= 2016-07-02 06:20:00
date2= 2016-07-04 15:00:00
the output should in number example date diff 5 hours means need output 5*60=300 minutes.
thanks, aaa
echo $((($(date -ud "$date2" +'%s') - $(date -ud "$date1" +'%s'))/60)) minutes
Comments
Post a Comment