Two days ahead

Hi,
I have a code that will show one day ahead, how to make it show two days ahead

p-dev1-db-tst:/$ day=$(TZ=IST-24 date +%d)
p-dev1-db-tst:/$ echo $day
17
p-dev1-db-tst:/$

Regards, Adam

Hi,

You should be able to use the date command as follows/

DATE=$(date -d "+2 days")

You don't say what the OS is so your local date command may vary.

Regards

Gull04

AIX 7.1

Hi,

The option that I've pointed out should work fine in AIX 7.1 use the

man date

command for further information.

Regards

Gull04

no in aix:

aix-tst:/$ DATE=$(date -d "+2 days")
date: Not a recognized flag: d
Usage: date [-u] [+"Field Descriptors"]

We get asked how to do date math in AIX so often I made a perl script for it. It's a GNU-date-alike that supports the "-d" option. It shouldn't require you to install any fancy modules.

General Purpose Date Script

1 Like