RSS Forums RSS
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 3849 | Replies: 2
Reply
Join Date: Mar 2007
Location: Islamabad, Pakistan
Posts: 19
Reputation: Masood Ali is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
Masood Ali's Avatar
Masood Ali Masood Ali is offline Offline
Newbie Poster

How to match Todays date in sql

  #1  
Mar 20th, 2007
Hi All
I want to check whether there is a record present in my database with value:
StartDate="Todays's Date"
where start date is the column name with datatype DATE.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 1,536
Reputation: masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light 
Rep Power: 10
Solved Threads: 141
masijade's Avatar
masijade masijade is offline Offline
Posting Virtuoso

Re: How to match Todays date in sql

  #2  
Mar 20th, 2007
Use PreparedStatement and new Date (using java.sql.Date not java.util.Date).

If you question is how to formulate a query in general, then please find an SQL forum.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Jul 2006
Location: Dublin,California
Posts: 2
Reputation: meduri99 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
meduri99's Avatar
meduri99 meduri99 is offline Offline
Newbie Poster

Re: How to match Todays date in sql

  #3  
Mar 23rd, 2007
If you have a query to fire , then use the SYSDATE as the standard one.
For example, on Oracle if I query as follows,

"select SYSDATE from DUAL", it should get me today's date. You may need to use this as part of your query. I understand you are in the midst of a Java program
So, after your query is built at Java area, you need to use the word "SYSDATE" which Oracle understands. I think it can work on other Databases too. But you may check it once.
Hope this helped.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 4:38 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC