db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Rana" <r...@solis.jp>
Subject comparing timestamp
Date Tue, 30 Sep 2003 05:52:45 GMT
Hi,

	I am having problem in writing a query based on dates. I have
following table
<table name="TBL_ORDERS">
	<column name="orderCreatedDate" type="TIMESTAMP"
required="true"/>
	<!--other columns removed-->
</table>
In mysql-
CREATE TABLE TBL_ORDERS
(
	orderCreatedDate TIMESTAMP NOT NULL
);

	I want to select records which lie between specified dates or
greater than a particular date. I tried following but none of these
work? 
1. criteria.addDate(TblOrdersPeer.ORDERCREATEDDATE, year,month,day,
Criteria.GREATER_THAN);
this results in: FROM TBL_ORDERS WHERE
TBL_ORDERS.ORDERCREATEDDATE>'20031029000000'

2. criteria.add(TblOrdersPeer.ORDERCREATEDDATE,(Object) "2003/09/30" ,
Criteria.GREATER_THAN);
this results in: FROM TBL_ORDERS WHERE
TBL_ORDERS.ORDERCREATEDDATE>'9/30/2003'

Date in the DB is: 9/30/2003 2:27:27 PM, I used following to set the
date
order.setOrdercreateddate(new Date(System.currentTimeMillis()));

Am I missing something obvious? Please advice how can I get this to
work? I want to search orders based on dates.

Regards,
Amit.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message