Search code examples
javamongodbmorphia

mongodb date converting issue


I am using mongoDB with morphia in java ,I am saving a value in date format

value before save : Wed Mar 14 03:09:23 IST 2012
after save in mongo : ISODate("2012-03-13T21:39:23Z")

Mongo adding some number of hours when it save , Is there any way to save this value as it is in date format

Thanks


Solution

  • mongodb saves datetime as "UTC DateTime", which you can refer to the following link.

    Dates - MongoDB

    To use the date you stored, just convert it to you local time. you will get the original.