Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

date difference between 2 timestamp

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sree reddy

New User


Joined: 20 Jul 2007
Posts: 27
Location: bangalore

PostPosted: Fri Dec 11, 2009 12:24 am    Post subject: date difference between 2 timestamp
Reply with quote

Could any one please send me query to get the NUMBER of days between 2 timstamps AND SUBTRACT SOME DAYS FROM THE DIFFERENCE

FOR EXAMPLE


select * From database.table
where date(End_ts)-date(current timestamp) - 50 days.

tHIS QUERY DID NOT WORK

Bye
Back to top
View user's profile Send private message

sree reddy

New User


Joined: 20 Jul 2007
Posts: 27
Location: bangalore

PostPosted: Fri Dec 11, 2009 12:25 am    Post subject: small correction in the query
Reply with quote

select * From database.table
where date(End_ts)<= date(current timestamp) - 50 days.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Fri Dec 11, 2009 12:36 am    Post subject: Reply to: date difference between 2 timestamp
Reply with quote

what about looking at the manuals Yourself!
starting from
http://www-03.ibm.com/systems/z/os/zos/bkserv/index.html
for the whole manuals shebang

to save You some precious time I took the liberty of pasting also the link to the db2 bookshelf
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/DSNSHKA3
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1280
Location: Belgium

PostPosted: Fri Dec 11, 2009 2:38 pm    Post subject: Re: small correction in the query
Reply with quote

sree reddy wrote:
select * From database.table
where date(End_ts)<= date(current timestamp) - 50 days.

a little bit better for performance :

Select * from tab1
where End_ts <timestamp(current date,'00.00.00') - 49 days
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us