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

I am working with an API integration to E-conomic using SOAP. The documentation for the SOAP call is listed here:

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

Everything works, except for when using the Date parameter, where I get this error:

object(SoapFault)#3 (10) { ["message":protected]=> string(304) "Economic.Api.Exceptions.SchemaException(E00500): The 'e-conomic.com:Date' element is invalid - The value '2016-09-17' is invalid according to its datatype 'w3.org/2001/XMLSchema:dateTime' - The string '2016-09-17' is not a valid DateTime value. (id=2bd3961a-1c13-46c9-8b4c-5dacd58ac4d4)" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(34) "/Applications//index.php" ["line":protected]=> int(89) ["trace":"Exception":private]=> array(1) { [0]=> array(6) { ["file"]=> string(34) "/Applications//index.php" ["line"]=> int(89) ["function"]=> string(6) "__call" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> string(28) "CashBookEntry_CreateFromData" [1]=> array(1) { [0]=> array(1) { ["data"]=> array(10) { ["Type"]=> string(15) "CreditorPayment" ["CashBookHandle"]=> array(1) { ["Number"]=> int(1767) } ["CreditorHandle"]=> array(1) { ["Number"]=> int(6750) } ["ContraAccountHandle"]=> array(1) { ["Number"]=> int(6750) } ["Date"]=> string(10) "2016-09-17" ["VoucherNumber"]=> int(1767) ["Text"]=> string(3) "API" ["AmountDefaultCurrency"]=> int(298) ["Amount"]=> int(298) ["CurrencyHandle"]=> array(1) { ["Code"]=> string(3) "DKK" } } } } } } } ["previous":"Exception":private]=> NULL ["faultstring"]=> string(304) "Economic.Api.Exceptions.SchemaException(E00500): The 'e-conomic.com:Date' element is invalid - The value '2016-09-17' is invalid according to its datatype '.w3.org/2001/XMLSchema:dateTime' - The string '2016-09-17' is not a valid DateTime value. (id=2bd3961a-1c13-46c9-8b4c-5dacd58ac4d4)" ["faultcode"]=> string(11) "soap:Client" ["detail"]=> string(0) "" }

I pass this date-format on the SOAP call:

date("Y-m-d");

But it keeps giving me the same error. Can anyone see what's wrong with the date I pass to the call?

The issue were fixed with date time class:

$d = new \DateTime();

$d->format('c')

This gives us the standard W3 datetime format.