wood burning stoves*
The moose likes JDBC and the fly likes date wise query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "date wise query" Watch "date wise query" New topic
Author

date wise query

rosei2000
Greenhorn

Joined: Jun 07, 2001
Posts: 1
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

Joined: Jan 07, 1999
Posts: 6920
"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.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
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

Joined: Jun 12, 2001
Posts: 7
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?


------------------------<br />Cheerios,<p>Wendy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: date wise query
 
Similar Threads
Dates as String
get the Yesterday's date ??
Date problem Not resolved
Struts 2 Multiple Input problem
add days to date