I am getting value like 202001.
I want to covert it like January_2020.
Is there a way to convert it like this?:
202001->January_2020
i tried to do this by using Intl and it is working fine for ios but not working in android.
i tried below one.
const dateToStr = (input) => {
if (input.length !== 6) {
return "wrong date syntax, use YYYYMM";
}
const parts = input.match(/([0-9]{4})([0-9]{2})/);
if (!parts) {
return "wrong date syntax, use YYYYMM";
}
// NOTE: check syntax of parts
const formatter = new Intl.DateTimeFormat("en-EN", { month: "long" })
.format;
const formatted = formatter(
new Date(Date.UTC(parseInt(parts[1]), parseInt(parts[2]) - 1))
);
return `${formatted}_${parts[1]}`;
};
How can i get this updated value in Javascript without using any library in android and ios both?