could you please suggest a method to add and subtract a certain number of
days to a date in Unix, i.e. the date returned by the "date" command?
Thank you in advance.
Br.
Diego.
RTFFAQ.
--
Stéphane ["Stephane.Chazelas" at "free.fr"]
> could you please suggest a method to add and subtract a certain number of
> days to a date in Unix, i.e. the date returned by the "date" command?
At least FreeBSD date(1) has -v switch for it, i.e.
'date -v +1d` will produce output with date adjusted one day to the
future. The recent versions of ksh93 have also quite good datetime
handling capabilities, i.e.
'printf "%T\n" "exactly tomorrow"` will produce the same output as
previous, excepting the locale issues.
--
Vallo Kallaste
Where is that documented? "printf --man" speaks of "%T", but
there's no specification for either the date/time syntax nor the
format.
I can see some indications in the source code for the "format"
in the "usage" variable in src/lib/libcmd/date.c (sort of
strftime-like not compatible with SUSv3 strftime, but with
interesting extensions).
I couldn't find anywhere information about "exactly tomorrow".
There's also src/lib/libast/man/tm.3, but it's not of much help.
> could you please suggest a method to add and subtract a certain
> number of days to a date in Unix, i.e. the date returned by the
> "date" command?
There's a section in the FAQ about this:
http://home.comcast.net/~j.p.h/cus-faq.html#G
Joe
--
I think people should be able to make up their own minds for me
- Monty Python
"Diego Balgera" <x.nospam.diego....@nokia.com> wrote in message
news:KM5Sb.7924$k4.1...@news1.nokia.com...
So, what about Reading The Fine FAQ and telling us why the
responses there don't suit your needs?
http://home.comcast.net/~j.p.h/cus-faq.html
http://www.faqs.org/faqs/by-newsgroup/comp/comp.unix.shell.html
http://groups.google.com/groups?q=wide_strftime&scoring=d
As you suggested, I found the solution of my problem here:
and in the excellent caljd.sh tool (thanks to A. Clay Stephenson).
Thank you again.
D.
"Diego Balgera" <x.nospam.diego....@nokia.com> wrote in message
news:KM5Sb.7924$k4.1...@news1.nokia.com...