aspose file tools*
The moose likes JDBC and the fly likes To get  the date one week from current date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "To get  the date one week from current date" Watch "To get  the date one week from current date" New topic
Author

To get the date one week from current date

pavani potnuru
Greenhorn

Joined: Nov 04, 2007
Posts: 11
Hi,
I need the get the currentdate+1 week . So that I can compare with another date which i get from database. Help me out in this. I have Oracle 9i. I need a query compatible to this version.
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

You could do this easily in Java using the Calendar class. Does it need to be part of the query? Any Oracle solution you come up with is going to be pretty non-portable.
[ January 16, 2008: Message edited by: Scott Selikoff ]

My Blog: Down Home Country Coding with Scott Selikoff
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
Originally posted by Scott Selikoff:
You could do this easily in Java using the Calendar class. Does it need to be part of the query? Any Oracle solution you come up with is going to be pretty non-portable.

[ January 16, 2008: Message edited by: Scott Selikoff ]


It's also pretty easy in almost any DBMS... there are differences... but they are all similar.

DB2

select current date + 7 day

Oracle

select sysdate + 7

mysql

SELECT CURDATE() + interval 7 day

or

SELECT DATEADD(currdate()interval 7 day)
[ January 16, 2008: Message edited by: Paul Campbell ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To get the date one week from current date