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: 10211
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: 1278
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 Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm


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