Hello everyone I am trying to set an _id to store images on a collection database. I would like to set the id of the row to the current date formatted for example like this:
30 June 2022 12:00=> 300620221200
there is a way to do this?
the Date that I am currently getting is with spaces and it isn’t really good to be used for an id:
This is the date I am getting
Mon Jun 27 2022 10:17:15 GMT+0200 (CEST)
With this code:
let currentDate = new Date();
let currentDateString = currentDate.toString()
console.log(currentDateString);
And the result I want is this:
27062022101715