I'm developing a website in 3 languages and using setlocale() with strftime() to show the date in the correct language.
setlocale(LC_TIME, "fr_FR.utf-8");
setlocale(LC_TIME, "ar_LB.utf-8");
setlocale(LC_TIME, "en_US.utf-8");
The only issue that i have is that the time for the French is not showing am or pm while the others are, this is the code i'm using:
$tmpdate = strtotime($test->time);
$finalTime = strftime('%I:%M %P', $tmpdate);
There is no AM/PM in french. The time is displayed in 24 hours format. You have to use %H
or %k
for this language.
$finalTime = strftime('%H:%M', $tmpdate); // 17:57 = 5:57 PM