新手问题 - 在mysql/php中,怎么改变日期输入的格式?

WBOY
Release: 2016-06-06 20:52:34
Original
1001 people have browsed it

我是用 now() 这个函数来把现在的时间读到数据库中的,输出之后显示的是 「2011-10-10 10:47:39」

我现在只需要 「10:47:39」这么多,请问怎么修改?

回复内容:

我是用 now() 这个函数来把现在的时间读到数据库中的,输出之后显示的是 「2011-10-10 10:47:39」

我现在只需要 「10:47:39」这么多,请问怎么修改?

给你个通用的解决方法吧

$input = '2011-10-10 10:47:39';
$output = date('H:i:s', strtotime($input));
echo $output;
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!