In my project I have PostgreSql table which contain date
(Data type date)column. The date received from column is being passed to getData function.
I am getting output in format 03122021
, which I want to convert in format 2021-12-03
(YYYY-MM-DD) DATE ONLY
. How can I make the conversion?
async getData(date){
console.log("date is ", date); ---->>> date is 03122021
const d = new Date(Date.parse(date));
console.log('d', d) ---->> d Invalid Date
}