我正在用3种语言开发网站,并使用strftime((使用setlocale((以正确的语言显示日期。
setlocale(LC_TIME, "fr_FR.utf-8");
setlocale(LC_TIME, "ar_LB.utf-8");
setlocale(LC_TIME, "en_US.utf-8");
我唯一的问题是,法国人的时间没有显示AM或PM,而其他人则是我正在使用的代码:
$tmpdate = strtotime($test->time);
$finalTime = strftime('%I:%M %P', $tmpdate);
法语中没有am/pm。时间以24小时格式显示。您必须将%H
或%k
用于此语言。
$finalTime = strftime('%H:%M', $tmpdate); // 17:57 = 5:57 PM