I am a novice to use “jdbc” and I have some problems. I use “where” to select the data in mysql in ten minutes. For example, if the time is 2018-4-4 10:11, then I want the data between 2018-4-4 10:01 and 2018-4-4 10:11. There is a column named “cTime” which type is TimeStamp.
This is my code:
Date date = new Date();
Timestamp nousedate = new Timestamp(date.getTime()-10*60*1000);
"select app.appkey from " + getClassName() +" app where app.cTime >" +nousedate + " group by app.appkey”
And It didn’t work. If I change the code to:
"select app.appkey from " + getClassName() +" app
where app.cTime > 2018-4-4 10:01’’
group by app.appkey”
Then it works.
I don’t know what’s wrong. I use many methods, but they didn’t work. So I want to get some help.
Thanks in advance.