I'd like to get the Epoch timestamp of a date being entered by a user, but convert the time to 12:01 am in JavaScript.
How do I do that?
I'd like to get the Epoch timestamp of a date being entered by a user, but convert the time to 12:01 am in JavaScript.
How do I do that?
Take the timestamp and pass it while creating a instance of the Date class like:
let timestamp = 1629289414;
let dateInstance = new Date(timestamp * 1000);
console.log(dateInstance); // Wed Aug 18 2021 14:23:34....
From there on you have many ways to work with dateInstance. To get the 12:00am result from this it's more a string manipulation/adjusting thing.
Just check out the documentation on the the javascript Date instance: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Date
If you have further questions just post the code you've written and maybe I can help you out