PHP:将日期时间转换为时间字符串的最佳方法? [英] PHP: Best way to convert a datetime to just time string?
本文介绍了PHP:将日期时间转换为时间字符串的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个从数据库中提取的日期时间,如下所示: 2000-01-01 08:00:00
I have a datetime that I pulled from the database that looks like this: 2000-01-01 08:00:00
现在我需要转换它,所以剩下的就是: 08:00:00
Now I need to convert it so all I have left is: 08:00:00
执行此操作的最佳方法是什么?
What is the best way to do this?
推荐答案
我应该早点想到过……最简单的方法是使用MySQL TIME()
函数只选择第一时间。
I should have thought of this earlier...easiest way would be to use the MySQL TIME()
function to only select the time in the first place.
这篇关于PHP:将日期时间转换为时间字符串的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文