I am using Java and iterating over D.B. column which in return gives me date and time string as shown below:
String dateTime = resultSet.getSeries().get(0).getValues().get(0).get(0);
If I iterate on this resultset I am getting dateTime values in format as shown below.
2017-07-20T19:21:37.987792408Z
2017-04-24T22:04:26.808753375Z
2017-08-14T22:22:40.340772396Z
2017-06-24T22:24:32.422544491Z
2017-07-31T22:27:05.893368615Z
Out of these records, how can I compare date string with "current" date object and discard those values which are more than 10 days old?
I tried
Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").parse(s);
That didn't work. Any other idea?
Edit: I am using Java7 and using InfluxDB that does not provide sysdate column while querying. So I have to come up with solution using Java.