Java MongoDB Date field format issue

917 views
Skip to first unread message

Rakesh

unread,
Feb 26, 2015, 11:29:40 PM2/26/15
to mongod...@googlegroups.com
Hi MongoDB users


How to retrieve ISO "CREATE_DATE" : ISODate("2002-02-21T05:30:00.000+0530"),  date from from mongoDB using JAVA .

My date from the application i am giving as String format ("2002-02-21") and tired converting in to the above format by 
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.000'Z'");

and while invoking the query is formed as below.

{ "CREATE_DATE" : { "$gte" : "2013-11-17T00:00:00.000Z" , "$lt" : "2015-11-17T00:00:00.000Z"} , "QUEUE_ID" : 4576}

But still unable to search in mongo DB giving 0 output , Can anyone please help me to resolve the issue . how to exactly convert the date given in String to ISODate format which mognoDB identify.

Regards
Rakesh


Jeff Yemin

unread,
Feb 27, 2015, 9:00:14 AM2/27/15
to mongod...@googlegroups.com
It looks like the dates are coming through as String instances rather that dates.  Can you post some sample code please?

Regards,
Jeff

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/3fd7b055-1808-4071-aef2-307bdc9d05b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages