将mysql TIME从24 HR转换为AM / PM格式 [英] Converting mysql TIME from 24 HR to AM/PM format

查看:138
本文介绍了将mysql TIME从24 HR转换为AM / PM格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上显示我的mysql表中的TIME字段,而不是显示21:00:00等等,我想在8:00 PM显示。我需要一个函数/代码来做到这一点,甚至是正确的方向的任何指针。将一些代码标记为正确的答复。

I want to display the TIME field from my mysql table on my website, but rather than showing 21:00:00 etc I want to show 8:00 PM. I need a function/code to do this or even any pointers in the right direction. Will mark the first reply with some code as the correct reply.

推荐答案

请查看: http://dev.mysql.com/doc/refman/5.0/en/date -and-time-functions.html

我想象你会想要date_format()。

I'd imagine you'd want date_format().

示例:DATE_FORMAT($ date,%r)

Example: DATE_FORMAT($date, "%r")

这篇关于将mysql TIME从24 HR转换为AM / PM格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆