| Author |
Resultset based on current Date and Time
|
SP Nam
Ranch Hand
Joined: Oct 15, 2003
Posts: 41
|
|
Hi I want to show Date and one field value from database in a drop down. I am using jstl for this in my jsp page. My query is like this: select product_name from Product where production_timestamp > to_date('2005-10-25 00:00:00','yyyy-MM-dd hh24:mi:ss') and production_timestamp < to_date('2005-10-25 23:59:59','yyyy-MM-dd hh24:mi:ss') I have to show the products produced for a particular day. The query has to pick a current time stamp dynamically when I execute the jsp page. Any suggestions. SP Nam
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56233
|
|
|
Moved to the JDBC forum as this is more about the query than about the JSP.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26218
|
|
Which timestamp are you trying to get? 1) the production_timestamp - add it to the query 2) the current time on the database server - add it to the query 3) the current time in the application - just use Java
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
SP Nam
Ranch Hand
Joined: Oct 15, 2003
Posts: 41
|
|
I want to get products produced for current day, it will be on database server. SP Nam
|
 |
Sabarish Sasidharan
Ranch Hand
Joined: Aug 29, 2002
Posts: 73
|
|
current date returns current date in DB2. Not sure about other RDBMS, but they should have something similar. If you use Prepared statements, then use and in the place of ? substitute -> new java.util.Date(). [ October 26, 2005: Message edited by: Sabarish Sasidharan ]
|
Sab<br /> <br />Perfection does not come from belief or faith. Talk does not count for anything. Parrots can do that. Perfection comes through selfless work.<br />Swami Vivekananda
|
 |
 |
|
|
subject: Resultset based on current Date and Time
|
|
|