XeroOAuth-PHP icon indicating copy to clipboard operation
XeroOAuth-PHP copied to clipboard

Invoice Payment dates are returned in .NET DataContractJsonSerializer format

Open schmoove opened this issue 9 years ago • 0 comments

Ultimately this is more a fault of the API itself, but it would be helpful if the library converted these dates to ISO format for us.

Has been an ongoing issue in the forums for 4+ (!!!!!) years now

An easy solution would only have to be a few lines of code (referenced from here):

preg_match('~(\d+)\d{3}((?:\+|-)\d+)~',  $date, $match);
$dt = new DateTime('@' . $match[1]);
$dt = new DateTime($dt->format('Y-m-d H:i:s') . ' ' . $match[2]);
$date = strtotime($dt->format('r'));

schmoove avatar Jun 01 '16 21:06 schmoove