Today I had to grapple with a Sage based web service and I discovered that XML dateTime formats can give you a large headache

Foolishly I thought that being a format called dateTime, i could simply pass the webservice a standard PHP date string 19/7/2011 10:05:55 generated by the php date function date('d/m/Y H:i:s');

But the date would not appear on the receiving end of the web service, the data was simply being invalidated every time. This is due to the fact that the xsd:dateTime (XML scheme definition) format is a ISO8601 formatted type, and is a concatenation of xsd:date and xsd:time. The overall format of the date comes out like 2011-07-11T13:20:00+01:00, with T being the concatenation and the +1:00 being the UTC timezone offset. Nicely enough PHP can generate this type of timestamp with our friend the date function, simply run: date('c');

Wasn’t too difficult was it :p