值'2016-09-17'根据其数据类型无效-如何修复


The value '2016-09-17' is invalid according to its datatype - how to fix?

我正在使用SOAP与e - economic集成API。这里列出了SOAP调用的文档:

https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=CashBookEntry_CreateFromData

一切正常,除了使用Date参数时,我得到这个错误:

object(SoapFault)#3 (10) {["message":protected]=> string(304)"Economic.Api.Exceptions.SchemaException(E00500): The 'e- economic.com:Date'元素是无效的-值'2016-09-17'根据其数据类型'w3.org/2001/XMLSchema:dateTime'是无效的-字符串'2016-09-17'不是一个有效的DateTime值。(id = 2 bd3961a-1c13-46c9-8b4c-5dacd58ac4d4) "【"字符串":"异常":私人]=>字符串(0)"("代码":保护)=> int(0)("文件":保护)=>字符串(34)"/应用程序//index . php"["线":保护]=> int(89)("跟踪":"异常":私人]=>数组(1){[0]=>数组(6){("文件")=>字符串(34)"/应用程序//index . php"("行")=> int(89)("函数")=>字符串(6)"__call" ["class"]=> string(10)"SoapClient" ["type"]=> string(2)"->" ["args"]=> array(2) {[0]=> string(28)"CashBookEntry_CreateFromData"[1]=>阵列(1){[0]=>数组(1){["数据"]=>数组(10){["类型"]=>字符串(15)"CreditorPayment" ["CashBookHandle"]=> array(1) {["Number"]=> int(1767)} ["CreditorHandle"]=> array(1) {["Number"]=> int(6750)} [" contraccounthandle "]=> array(1) {["Number"]=> int(6750)} ["Date"]=> string(10)"2016-09-17"["VoucherNumber"]=> int(1767)("文本")=>字符串(3)"API" ["AmountDefaultCurrency"]=> int(298) ["Amount"]=> int(298) ["CurrencyHandle"]=> array(1) {["Code"]=> string(3)"DKK " } } } } } } } [" 以前的":"异常":私人]=>空["faultstring"]=>字符串(304)"Economic.Api.Exceptions.SchemaException(E00500): The 'e- economic.com:Date'元素是无效的-值'2016-09-17'根据其数据类型'.w3.org/2001/XMLSchema:dateTime'是无效的-字符串'2016-09-17'不是一个有效的DateTime值。(id = 2 bd3961a-1c13-46c9-8b4c-5dacd58ac4d4) "[" faultcode "] =>字符串(11)"soap:Client" ["detail"]=> string(0)"}

我将这个日期格式传递给SOAP调用:

date("Y-m-d");

但是它总是给我同样的错误。有人知道我传递给电话的日期有什么问题吗?

日期时间类:

$d = new 'DateTime();

$ d ->格式(c)

这给了我们标准的W3日期时间格式