Adding/ Subtracting from Date

Hi ,

How can I add/substruct x number of days with date?

For example

 My_Date=`date`

Now I need

Hope it's clear.

With GNU date:

future=`date -d"+$x days"`
past=`date -d"-$x days"`

Also, take a look at this link.

1 Like

Depending on your OS flavour and version (please tell us - it does really help) you may be able to issue:-

date --set="today + 1 day"

I hope that this helps, but if not, a good search of these forums will offer plenty of suggestions.

Robin
Liverpool/Blackburn
UK

1 Like