开发者

Converting a mysql time format 00:00:00 to 00:00 AM/PM with PHP

开发者 https://www.devze.com 2023-03-01 15:34 出处:网络
I\'m trying to convert a time format from my mysql DB. The time stored in there is 12:00:00 and i want 开发者_JAVA技巧it to be displayed as 12:00 PM. How would i do this?

I'm trying to convert a time format from my mysql DB. The time stored in there is 12:00:00 and i want 开发者_JAVA技巧it to be displayed as 12:00 PM. How would i do this?

Here is what i tried:

$overdueTime = strftime('%I:%M %p', strtotime($settings_row[3]));

With $settings_row[3] being the time.

thanks in advance ^.^


Backend i converted it to military time:

strftime('%H:%M:%S strtotime($_POST["overdueTime"]));

Frontend i converted to 12 hour time:

strftime('%I:%M %p', strtotime($settings_row[3]));

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号