IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

date difference between 2 timestamp


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Dec 11, 2009 12:36 am
Reply with quote

what about looking at the manuals Yourself!
starting from
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top