时时商务社区

标题: php mssql 日期出现中文字符的解决方法 [打印本页]

作者: bewin83    时间: 2018-2-14 09:21

            比如: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
            
            
您可能感兴趣的文章:
  • php mssql扩展SQL查询中文字段名解决方法
  • thinkphp3查询mssql数据库乱码解决方法分享
  • ThinkPHP2.0读取MSSQL提示Incorrect syntax near the keyword ''AS''的解决方法
  • PHP连接MSSQL时nvarchar字段长度被截断为255的解决方法
  • php5.3不能连接mssql数据库的解决方法
  • php查询mssql出现乱码的解决方法
  • php读取mssql的ntext字段返回值为空的解决方法
            




    欢迎光临 时时商务社区 (http://bbs.4435.cn/) Powered by Discuz! X3.2