Converting a date format to a local date format

Hello,
I cannot change the format because this date format is the countdown code.
I want to convert this date format to show in local text

How can I convert this “31 Mar 2022 15:00:00” date format to local date format with javascript
Local date format as below:
31 Mart 2022 Perşembe, Saat 15:00

Thank you

Your asking about a different language then? (instead of date formatting?)

I want to write time in Turkish
I found something like the following, I did it, I got the result I wanted, but I don’t know how accurate it is.

function dateToYMD(tarihdate) {
    var monthNames=['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'];
    var dayNames=['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'];
    var d = tarihdate.getDate();
    var m = monthNames[tarihdate.getMonth()];
    var y = tarihdate.getFullYear();
    var g = dayNames[tarihdate.getDay()];
    var h = tarihdate.getHours();
    var mm = tarihdate.getMinutes();
    return '' + (d <= 9 ? '0' + d : d) + ' ' + m + ' ' + y + ' ' +g + ', Saat ' + h + ':' + mm;
}
console.log(dateToYMD(new Date("31 Mar 2022 15:00:00") ));

Output
“31 Mart 2022 Perşembe, Saat 15:0
Why does the minute show one zero?

Sponsor our Newsletter | Privacy Policy | Terms of Service