Unix True 64 - using the tru64 date utility to present yesterdays date

This is Interesting: Free IT Magazines  
Home > Archive > Unix True 64 > July 2007 > using the tru64 date utility to present yesterdays date





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author using the tru64 date utility to present yesterdays date
Banzai

2007-07-02, 1:20 pm

Hello

The implementation of date in linux has a -d flag to present yesterdays
date.

For instance

# date +"%Y-%m-%d"
2007-07-02
# date +"%Y-%m-%d" -d yesterday
2007-07-01

Is there something similar for tru64 ?? as it doesn't seem to support the -d
flag


nafc@snet.net

2007-07-03, 1:22 pm

On Jul 2, 10:24 am, "Banzai" <ban...@aaa.com> wrote:
> Hello
>
> The implementation of date in linux has a -d flag to present yesterdays
> date.
>
> For instance
>
> # date +"%Y-%m-%d"
> 2007-07-02
> # date +"%Y-%m-%d" -d yesterday
> 2007-07-01
>
> Is there something similar for tru64 ?? as it doesn't seem to support the -d
> flag


Try this:

#!/bin/ksh -vx

localtime=$(date +%H)
utc=$(date -u +%H)

offset=$(($utc - $localtime))
today=$(TZ="EST${offset}EDT${offset}" date)

offset=$(($offset + 24))
yesterday=$(TZ="EST+${offset}EDT+${offset}" date)

Banzai

2007-07-04, 7:20 am


<nafc@snet.net> wrote in message
news:1183466270.387710.95560@k79g2000hse.googlegroups.com...
> On Jul 2, 10:24 am, "Banzai" <ban...@aaa.com> wrote:
>
> Try this:
>
> #!/bin/ksh -vx
>
> localtime=$(date +%H)
> utc=$(date -u +%H)
>
> offset=$(($utc - $localtime))
> today=$(TZ="EST${offset}EDT${offset}" date)
>
> offset=$(($offset + 24))
> yesterday=$(TZ="EST+${offset}EDT+${offset}" date)
>


thanks - just what I need


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com