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: 10308
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 Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm

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