Skip to content
Advertisement

Tag: mongodb-java-3.3.0

How to read date (Timestamp) from MongoDB using Java

Am trying to read date field from MongoDB in below format In the result 2017-01-23 22:16:07.000000, instead of 000 it should be the 812 (Original value: 2017-01-23-10.46.07.812000) Note: Using MongoDB Java driver 3.4. Thank you in advance! Bharathi Answer You can use Java’s SimpleDateFormat to format the date accordingly. For example, assuming you inserted the date in MongoDB using the

Advertisement