You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Gary Lawrence Murphy <ga...@canada.com> on 2001/06/20 08:10:43 UTC

How to compare DATETIME (Re: Panic attack)

No, on second thought, I was right the first time: Criteria has no
add(datecolumn, java.util.Date, comparison)

A non-portable work-around is to format the date into a MySQL-accepted
string format and submit that instead (using SimpleDateFormat):

        SimpleDateFormat df
            = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");
        String now = formatter.format(new Date());
        Criteria c = new Criteria()
            .add( TableA.EXPIRES, now, Criteria.LESS_THAN );
        TableA.doDelete(c);

it is also curious that Torque DATE does not map to DATE but maps
to DATETIME, whereas Torque TIME maps to TIME and TIMESTAMP maps
to TIMESTAMP ... almost every SQL server supports DATETIME, so it
is probably a good idea to have DATE map to DATE and introduce a
DATETIME option.

-- 
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless.  They can only give you answers."(Pablo Picasso)


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