简体   繁体   中英

How to determine if current locale has 24-hour or 12-hour time format in PHP?

This seems like a dumb question, but I've read the docs and couldn't find any straight-forward method.

I did something awful like:

$isTwentyFourByLocale = (substr(strftime('%X', mktime(16, 0, 0, 6, 15, 2010)), 0, 2) == 16);

Which works, but isn't there any better, straight-forward way?

使用您的方法,可以缩短时间:

$isTwentyFourByLocale = (substr(gmstrftime('%X', 57600), 0, 2) == 16);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM