The following command generates the date for the next day:
date -d "20150615 12:00 +1 day" +%Y%m%d
20150616
I would like to specify my own INPUT date format, such as:
2015_06_15
But the date command does not like this format and complains about invalid date:
date: invalid date '2015_06_15 12:00 +1 day'
Is it possible to use such a date format? And if so how could I do this.
A workaround:
x="2015_06_15"
date -d "${x//_/} 12:00 +1 day" +%Y%m%d
Output:
20150616
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