• Anasayfa
  • .
  • Blog
  • .
  • PHP strftime() function Turkish Character Problem

PHP strftime() function Turkish Character Problem

PHP strftime() function Turkish Character Problem

When using strftime() in

PHP, when we convert dates to Turkish, Turkish; If e characters sound garbled, you can solve your problem by following the methods below. Before we print our date codes to the screen, we add these codes and ensure that the dates come to Turkish.

date_default_timezone_set('Europe/Istanbul');
setlocale(LC_ALL, 'tr_TR.UTF-8');
setlocale(LC_TIME, 'tr_TR.UTF-8');

If we get a character error, we can print our date inside the function by converting it to UTF-8 as follows.

$date = strftime('%d %B %Y');
utf8_encode($date); // By encoding in this way, we solve the character problem.
Türkçe English Deutsch Dansk Español Română