I have a date string that I am able to parse and format with the date
command from a bash script.
But how can I determine how many days ago this date was from my script? I would like to end up with a number.
Set it to the number of days that you want to subtract. Very slight improvement to the command - date --date="${dataset_date} -${date_diff} day" +%Y-%m-%d.
Use date itself as date value for date. Example 5 days ago:
date -d "`date`-5days"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With