View previous topic :: View next topic
|
Author |
Message |
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
Hi
In my database i have a date field and i want to add 10 or 20 days to it.
how can i get this in COBOL or SQL?
Ex: WS-DATE = 2009-01-31(YYYY-MM-DD format)
WS-VAR = 10
and i want to add 10 days to
WS-DATE field to get WS-FINAL-DATE = 2009-02-10 |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
Use DATE(:WS-DATE) + 10 DAYS in your update ... |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
Hi ,
Code: |
SELECT CURRENT TIMESTAMP
,WS-DATE - :WS-NUM DAYS
,WS-DATE + :WS-NUM-2 DAYS
INTO :WS-TSMP-X
,:WS-CUTOFF
,:WS-CUTOFF-DTE-2
FROM TABLE NAME
WHERE COL1 = CURRENT DATE
|
May be this can help you |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi Ketan,
Please read what OP wants.
He doesnt want to update only records with todays date..
Also what is COL1 in your query? |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
Hi Sambhaji,
Correct me if I am wrong ,
In the above query I think he will able to add 10 or 20 day to the variable or the column he want to and COL1 is just a sample column name if there is some criteria of doing the operation. Thats just the sample one
Ketan |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
In the above query I think he will able to add 10 or 20 day to the variable or the column he want to |
How would the posted query know about 10 or 20?
Please be much more careful when posting suggestions/solutions. Incomplete/incorrect info only makes things harder for the person who asked the question. |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
Sorry Dick,
But what I understood from the question I tried answer to that I understood from the post. Please can some one make me understand what the requirement is basically .
I will take care in the coming future |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Please can some one make me understand what the requirement is basically . |
The post from Ashimer provides the answer to the question asked by Sashi. How to add a number of days to some date. . . |
|
Back to top |
|
|
|