Setting Date Variable +1 date

I need to set a date varable within ksh that will set the date to the next day in the format 25-JUL-2013 - any help would be appreciated.

Portable options for date math are limited. You might have the super-new ksh needed for that, or not. You might have the super-new nawk needed for that, or not. You might have GNU date available, or not.

Or you could use perl, which is available the same way almost everywhere. The current day, in dd-Mon-yyyy format, plus 86400 seconds:

DATE=$(perl -e 'use POSIX qw(strftime);  print strftime $ARGV[0]."\n", localtime(time()+$ARGV[1]);' -- "%d-%b-%Y" 86400 )

If you don't have the GNU functionality, try tweaking your timezone $TZ

Some systems have a limitation that you cannot go forwards or backwards beyond 24 hours, but some allow a seemingly limitless offset. If your value for $TZ is like GMT0BST........ then you can easily set it:-

Orig_TZ="$TZ"
TZ=GMT-24BST
date +%b-%b-%Y
TZ="$Orig_TZ"

If you are with EST5EDT, then:-

Orig_TZ="$TZ"
TZ=EST-19EDT
date +%b-%b-%Y
TZ="$Orig_TZ"

Some systems do not have a TZ set. If so, you need to export the value and unset it at the end:-

export TZ=GMT-24BST
date +%b-%b-%Y
unset TZ

I hope that this gives you an option, but it is highly OS specific in what it will allow. There are various other date calculation threads on the forums here to search through too.

Robin

Changing TZ worked - thanks so much for your help