Home > Backend Development > PHP Tutorial > 初学者请教日期显示问题

初学者请教日期显示问题

WBOY
Release: 2016-06-23 13:31:22
Original
860 people have browsed it

我是用PHP+SQL SERVER2005处理datetime字段出现问题。
举例说明下:
数据库里字段名issue_date 字段类型datetime
我用$short=date("Y-m-d",strtotime($rs["issue_date"]));echo $short;显示却是1970-01-01;
strtotime($rs["issue_date"]);显示为空;
直接echo $rs["issue_date"],读取数据库显示为08 7 2014 1:08PM.
说明是数据库读取出的日期格式不对,请问这个问题怎么处理,想显示短日期格式。谢谢


回复讨论(解决方案)

可以直接用mssql语句吧类型datetime变成日期啊

查询时 convert(char, 你的日期字段 ,120)

一句话点醒了,谢谢

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