MongoDB DateTime Format

后端 未结 5 1064
遇见更好的自我
遇见更好的自我 2021-01-16 08:25

In mongodb adhoc query, before executing the query, how to format the date type element to dd\\mm\\yyyy format and then execute the query?

5条回答
  •  死守一世寂寞
    2021-01-16 09:21

    This is use full to format code to date format from simple date time format and the reverse steps also supporting this way to retrieve date from MongoDB.

      SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
      Date fDate = formatter.parse((String) metaData.getValue());
      newMeta.setValue(fDate);[![In this image you can see how is the save scenario process in mongoDB][1]][1]
    

提交回复
热议问题