php 向sqlerver datetime类型插入数据

cjqcy416 2017-12-07 05:35:57
用PHP调用WCF后,有一个add方法,参数是对象,向SQL Server插入数据,有一个字段CreateDate类型是datetime,执行就会报错


<?php
$client=new SoapClient("http://192.168.117.223:81/EIPMail.svc?wsdl");
$res = array(
"MailID"=>'BUG00000004',
"Account"=>'353234',
"Address"=>'cjqcy416',
"MailSubject"=>'主题',
"MailBody"=>'正文',
"Url"=>'www.baidu.com',
"SystemName"=>'百度',
"SystemSort"=>'A9',
"Address_BCC"=>'',
"Address_CC"=>'',
"CreateMan"=> 'cjqcy416',
"CreateDate"=> date("Y-m-d H:i:s",time()),
"MailType"=>'通知',
"ID"=>0
);
$info = array('EipMail'=>$res);
$result1 = $client->DoAdd($info);


Fatal error: Uncaught SoapFault exception: [a:DeserializationFailed] The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:EipMail. The InnerException message was 'There was an error deserializing the object of type EipMail.Model.EipMailTable. The value '2017-12-07 17:34:04' cannot be parsed as the type 'DateTime'.'. Please see InnerException for more details.
...全文
596 2 点赞 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
A_5120 2018-05-30
建议不要使用datetime类型,我们一般都用时间戳(unix纪元到现在的秒数)来保存时间,类型就用无符号的int类型即可
  • 打赏
  • 举报
回复
cjqcy416 2017-12-11
看来真的黄了
  • 打赏
  • 举报
回复
相关推荐
发帖
基础编程
加入

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
帖子事件
创建了帖子
2017-12-07 05:35
社区公告
暂无公告