File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

date wise query

 
rosei2000
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a HTML file in which i getting 6 parameters . 3 for from & 3 for to means month,date & year for from & same for to.means i want to display data like select * from table where dateofbirth falls between from and to..
how i can solve this problem
 
Frank Carver
Sheriff
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"rosei2000",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
select * from tblname where birthdate > to_date( fromMM | | fromDD | | fromYYYY, 'MMDDYYYY') and birthdate < to_date( toMM | | toDD | | toYYYY, 'MMDDYYYY')
[This message has been edited by Daniel Dunleavy (edited June 07, 2001).]
 
Wendy Cheong
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Just to add on, if u want to do a select from date1 to date2, I think its advisable to store your dates in the following string format in your database : yyyymmdd, eg, 19990101 and 20001212. So, to search for dates between 1/1/1999 and 12/12/2000, all you have to do is to search for strings between 19990101 to 20001212.
It'll also save you some time since all you need to do is to concatenante the year, month and day fields to produce the search string.
Any comments anyone?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic