I have a datetime field in MySQL which I access through calling result.getString('date'), now I would like to check weather the current date and time in Java has exceeded the MySQL time or is before the MySQL time to check weather a result is activated or not.
Datetime from MySQL has the form: 2011-12-30 17:10:00, how can I compare this string to the Java time?
解决方案
Prior to JDK 8
You can use ResultSet.getDate('date') to retreive a Date object. Then use the method Date.before() or Date.after() to check.
JDK 8 or later
Refer to Basil Bourque's answer below.