Date function

Date function

Post by Diego Balger » Fri, 30 Jan 2004 20:04:10



Hi,

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.

 
 
 

Date function

Post by Stephane CHAZELA » Fri, 30 Jan 2004 20:22:57


2004-01-29, 11:04(+00), Diego Balgera:

Quote:> 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?

RTFFAQ.

--
Stphane                      ["Stephane.Chazelas" at "free.fr"]

 
 
 

Date function

Post by Vallo Kallast » Fri, 30 Jan 2004 22:01:38



> 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
 
 
 

Date function

Post by Stephane CHAZELA » Fri, 30 Jan 2004 23:10:22


2004-01-29, 15:01(+02), Vallo Kallaste:
[...]

Quote:> 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.

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.

--
Stphane                      ["Stephane.Chazelas" at "free.fr"]

 
 
 

Date function

Post by j.. » Sat, 31 Jan 2004 05:05:44



> 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

 
 
 

Date function

Post by Diego Balger » Sat, 31 Jan 2004 19:53:47


Hi,
I forgot to specify that my environment is Hp Hp-ux 11.0.
D.


Quote:> Hi,

> 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.

 
 
 

Date function

Post by Stephane CHAZELA » Sat, 31 Jan 2004 20:19:54


2004-01-30, 10:53(+00), Diego Balgera:

Quote:> Hi,
> I forgot to specify that my environment is Hp Hp-ux 11.0.
> D.

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

--
Stphane                      ["Stephane.Chazelas" at "free.fr"]

 
 
 

Date function

Post by Diego Balger » Wed, 04 Feb 2004 23:06:38


Hi,
thank you to everyone for your valuable suggestions.

As you suggested, I found the solution of my problem here:

http://groups.google.com/groups?q=wide_strftime&hl=en&lr=&ie=UTF-8&sc...

and in the excellent caljd.sh tool (thanks to A. Clay Stephenson).

Thank you again.
D.


Quote:> Hi,

> 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.

 
 
 

1. Date function

Hi all,

Can someone tell me if there is a convenient way to do date addition
and subtraction in a Korne shell script ?

e.g. I want a date 3 days and do a:

mydate=((`date` - 3))

Something like this.


Thanks and regards,
Kenneth

2. Sending printer commands through remote queues

3. Date functions in awk

4. XFree_S3 garbeled fonts on SPEA V7

5. Date Function on Unix (hp-ux)

6. SMP in -STABLE broken?

7. date function

8. Intercepting mobile fone text/voice calls

9. Date functions

10. Fortran-callable date function

11. crypt() and date() function

12. the date function

13. SSI kills javascript date functions . . .