Home  >  Article  >  php教程  >  php mssql 日期出现中文字符的解决方法

php mssql 日期出现中文字符的解决方法

WBOY
WBOYOriginal
2016-06-13 12:24:30859browse

比如:2005-12-23 读出以后页面会显示为:2005 十二月 23 ,这样给程序处理带来很多不便。查找了一些资料发现是php.ini默认了日期处理功能。
解决方法为:
第一个方法:php文档开头定义ini_set(”mssql.datetimeconvert”,”0″);
第二个方法:修改php.ini,找到;mssql.datetimeconvert = On ,去掉前面的分号,修改on为off,重启apache即可

第三个方法:用SQL的 convert()函数转换,如:
SELECT id, title, convert(char(10),news_time,102) as publish_time, content FROM news

Statement:
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