My number is :
"202112110836"
I want separate this string into to:
"2021-12-11 08:36"
>Solution :
I don’t think such a function exists in jQuery or JavaScript itself for that specific date format; the other solution is to simply fetch each subsection of the string and split it accordingly to the format you want.
const input = "202112110836";
// Fetch each specific date value by substring.
const year = input.substring(0, 4);
const month = input.substring(4, 6);
const day = input.substring(6, 8);
const hour = input.substring(8, 10);
const minute = input.substring(10, 12);
// Combine it all together.
const output = year + "-" + month + "-" + day + " " + hour + ":" + minute;
console.log(output);