I use java.util.Date()
to get timestamps for insert to database.
When I view the result, the timestamps in the database is differente from the system machine time.
java.util.Date()
time: 22/10/2012 10:00:07 AM- System machine time: 22/10/2012 5:50:34 PM
I use MongoDB, here my code
Mongo mongo = new Mongo(DBConstants.DATABASE_HOST, Integer.parseInt(DBConstants.DATABASE_PORT));
DB db = mongo.getDB("library");
DBCollection books = db.getCollection("books");
BasicDBObject book = new BasicDBObject();
book.put("name", "Understanding JAVA");
book.put("pages", 100);
book.put("amount",10);
book.put("timestamp", new java.util.Date());
books.insert(book);
Who can explain this to me?