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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert date through shell script in a table

Status
Not open for further replies.

adev111

Programmer
Jul 8, 2004
44
CA
Hi there all
i am tryin to insert date from unix to db2 tables,
the format of date in unix is not compatible to db2 format. unix returns :Wed Nov 24 23:45:34 EST 2004 when asked for date, where as i want the date in the form yyyy-mm-dd, i know someone may suggest to parse it but i don't have enough time for this, is there any quick way of doing this?
thank you
 
print `date +"%Y-%m-%d"` gives 2004-11-25

so DATE=`date +"%Y-%m-%d"` produces a variable to be used in the script

 
adev111,

are you aware of the reserved words

current date
current time
current timestamp

etc.

You can us these in db2 if you wish to isolate this part of the processing from UNIX. OR is their a particular reason for taking it from UNIX.

You can set up your columns to effectively default to current date, if nothing is passed.

Cheers
Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top