Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get current date minus 30 days 1

Status
Not open for further replies.

bosoxer1

Programmer
Jan 22, 2005
20
0
0
US
I have two options. Get unix current date -30 days, and feed that into a db2 where clause, or have the db2 where clause itself get current daye - 30 days, in the format of char 2006051800. 00 can be appended, I hope.

Thanks in advance.
 
Have a look here: faq80-4800
Then you may try this:
GetDate -$((30 \* 24)) '+%Y%m%d00'


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi

I know, I know, this is Unix forum and Unix people have no GNU utilities, but anyway. This works with GNU [tt]date[/tt] :
Code:
date -d "30 days ago" "+%Y%m%d00"
But I would use the database functions for this.

Feherke.
 
Presumably there's no reason, legal or technical, why you can't take the source code of the GNU date and compile it on your own machine.

Ceci n'est pas une signature
Columb Healy
 
But I would use the database functions for this
I obviously totally agree !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top