Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10374
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: 1281
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 ISMF Difference between volume count ... upendrasri IBM Tools 2 Tue Dec 05, 2017 12:40 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm
No new posts Finding difference between two PS fil... Vignesh Sid SYNCSORT 5 Mon Oct 30, 2017 1:13 pm
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us