title: C# DateTime type over web service with PHP & SOAP
body: <p>I work with web services written in C#, with PHP on my (client) side.</p>
  
  <p>SOAP <code>__getTypes</code> returns that <strong>one</strong> of the expected parameter to be <code>dateTime birthDate</code>. I tried to send parameter in different ways, like</p>
  
  <pre><code>$date = new DateTime("now");
  $wsclient-&gt;SomeFunction(array($date-&gt;format("Y-m-d\TH:i:s"));
  </code></pre>
  
  <p>or <code>$date-&gt;format('c')</code> I even wrote it just as a string <code>1932-11-12T00:00:00</code> and so on. I do not get soap exception, but function returns that received <code>birthDate</code> value was <code>0001-01-01T00:00:00</code>.</p>
  
  <p>I had a meeting with the developer of web services and he showed me that when he passes <code>System.DateTime</code> type variable to the function it works properly, but he did it locally in C# and not over the web service, just doing</p>
  
  <pre><code>date = new DateTime(1999,9,9,0,0,0);
  SomeFunction(date);
  </code></pre>
  
  <p>What i want to know is how can i pass c# <code>DateTime</code> type from PHP. I guess that i'm doing it right with <code>$date-&gt;format('c')</code> or with <code>$date-&gt;format("Y-m-d\TH:i:s")</code>.</p>
  
  <p>I just want to make sure that this part of code is right and if so, search for problem in other place.</p>
  
  <p><strong>UPDATE:</strong> What we came to is: they changed code on their side. Data type remains the same (DateTime), I don't have an idea what they did there, but if I get any information, I'll keep this post up to date.</p>
  
  <p><strong>After few years:</strong> They just had no idea what they were doing and I got stuck with a problem, that was just impossible to solve by my side. If WSDL requests <code>DateTime</code> and you send it properly (SOAP doesn't throw an exception) and it doesn't work as it should, than you should be looking for the problem on the other end, for sure.</p>