date in MongoDB: when inserting Date objects into Mongo database, the date becomes 1 day earlier than itself
My date string format is like this: Jan 2, 2012 After the Instant.parse() method, instant instance becomes the date of Jan 1, 2012, which is 1 day earlier, why? If the original date string is jan 1, 2012, the Instant will be the date of Dec 31, 2011. String dateString="Jan 1, 2012"; Instant instant = Instant.parse(dateString, new DateTimeFormatterBuilder() .appendMonthOfYearShortText() .appendLiteral(" ") .appendDayOfMonth(1) .appendLiteral(", ") .appendYear(4, 4) .toFormatter()); DateTime dateTime = new DateTime(instant); Date date = new Date(dateTime.getMillis()); document.append("time", new