How to find the assets created since last run
My requirement is that my scheduled service will run at every 60 mins. I have done that.
Now I want to be able to find the assets created in last 60 minutes, I was writing a query for the same.So i created
DateTime dt = new DateTime();
DateTime modified_last_run_date = dt.minusMinutes(60);
DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
String last_run_time =modified_last_run_date.toString(dtf);
if I print the last_run_time string to console I get -- "2015-08-19T17:38:36.221+0530"
However when I write Query : SELECT p.* FROM [dam:Asset] AS p WHERE p.[jcr:created] >= CAST('2015-08-19T17:38:36.221+0530' AS DATE) I get java.lang.IllegalArgumentException: Not a date string: 2015-08-19T17:38:36.221+0530
but if I write SELECT p.* FROM [dam:Asset] AS p WHERE p.[jcr:created] >= CAST('2015-08-19T17:38:36.221Z' AS DATE) I get no compilation error and query runs but with a lag of 5:30 hrs i mean i don't get correct results.
Can anybody suggest me solution.
In brief I want to find in each hourly run of my service which were the assets created since last run.