PHP:将日期从mySQL格式化为仅日期 [英] PHP: formatting a date from mySQL to be date only

查看:106
本文介绍了PHP:将日期从mySQL格式化为仅日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从php的mySQL中显示一些记录,而我回覆的一个字段是一个日期字段,但是当前打印出的时间是最终的。



如何回覆日期?



解决方案


echo date('dm-Y',strtotime($ queryresult));


所有日期格式设置选项可以在这里找到:
http://nl3.php.net/ manual / en / function.date.php


I am displaying some records from mySQL from php and one of the fields I echo out is a date field but it currently prints out the time at the end to.

How can I just echo out the date?

解决方案

echo date('d-m-Y', strtotime($queryresult) );

All date formatting options can be found here: http://nl3.php.net/manual/en/function.date.php

这篇关于PHP:将日期从mySQL格式化为仅日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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