Manage date in bash

Manage date in bash

am 31.10.2007 16:22:53 von patrick

Hi,
do you know if exists a bash metods/function to do today date -1 day
or -2 day ecc?
example (object style)
today is 31102007, date.today(-1) = 30102007
Thanks

Re: Manage date in bash

am 31.10.2007 17:45:38 von Bill Marcum

On 2007-10-31, Patrick wrote:
> Hi,
> do you know if exists a bash metods/function to do today date -1 day
> or -2 day ecc?
> example (object style)
> today is 31102007, date.today(-1) = 30102007
> Thanks
>
The date command is not part of bash, but if you use bash, chances are
that you have GNU date, and you can use the -d option, for example
date -d yesterday
Tue Oct 30 12:42:50 EDT 2007
date -d yesterday +%d%m%Y
30102007

"man date" or "info date" for more details.

Re: Manage date in bash

am 05.11.2007 14:50:10 von patrick

On 31 Ott, 17:45, Bill Marcum wrote:
> On 2007-10-31, Patrick wrote:> Hi,
> > do you know if exists a bash metods/function to do today date -1 day
> > or -2 day ecc?
> > example (object style)
> > today is 31102007, date.today(-1) = 30102007
> > Thanks
>
> The date command is not part of bash, but if you use bash, chances are
> that you have GNU date, and you can use the -d option, for example
> date -d yesterday
> Tue Oct 30 12:42:50 EDT 2007
> date -d yesterday +%d%m%Y
> 30102007
>
> "man date" or "info date" for more details.

on solaris 10 it doesn't work... not exist "date -d"