Q:

Compare two timestamp days

In my application I designed a Spring scheduler that should pick records that has "abcDate" field with tomorrow's timestamp as value.
I have calculated timestamp in my java application as,
Calendar cal = Calendar.getInstance();
            cal.add(Calendar.DAY_OF_YEAR, 1);
            long abcTimeStamp = DateUtils.convertDateTimeToUTCzone(cal.getTimeInMillis()); 

value of this is : 1387348986 i.e) 12 / 18 / 13 @ 6:43:06am UTC
In DB I have a record, with timestamp 1387365854 i.e) 12 / 18 / 13 @ 11:24:14am UTC.
I am using couch DB map reduce view, and I pass the timestamp value as key to the view.
But since the time is different in both timestamps, I am not able to fetch this record. Is there a way to match only the days in timestamp and filter the records in view itself?

A:

CouchDB's concept of startkey and endkey is super useful here. 
It sounds like you've already got a view, but just for the sake of completeness let's assume it looks like this:
{
   "_id": "_design/mydesign",
   "_rev": "1-088646f81629ce559b6d9772c6116113",
   "views": {
       "by_timestamp": {
           "map": "function(doc) { emit(doc.timestamp, doc); }"
       }
   }
}

And you've got a database named 'timestamps' running locally with a handful of documents, as shown by:
$ curl localhost:5984/timestamps/_design/mydesign/_view/by_timestamp

To get a range of documents, add the startkey and endkey query parameters:
$ curl localhost:5984/timestamps/_design/mydesign/_view/by_timestamp\?startkey\=1387348986\&endkey\=1387365854

Now to get those parameters you'll need the timestamp of the start of tomorrow and the end of tomorrow. This answer covers that with the java.util.Calendar API and Joda-Time.
For more on finding many, check out CouchDB's awesome new docs.

