I know there is probably a simple answer to this but I have tried several things and nothing seems to work.
I have the following data taken from a JSON array:
{
"Id": 21973679,
"InvoiceNumber": 13,
"IssueDate": "14/08/2017",
"EulerID": 6162023,
"CustomerName": "Alderley plc",
"TotalAmount": "1,704.00",
"TotalTaxAmount": 0,
"Currency": "USD",
"DueDate": "13/09/2017",
"AmountDue": "0",
"Status": "Paid"
},
{
"Id": 21974783,
"InvoiceNumber": 23,
"IssueDate": "09/01/2017",
"EulerID": 6162023,
"CustomerName": "Alderley plc",
"TotalAmount": "11,000.00",
"TotalTaxAmount": 0,
"Currency": "GBP",
"DueDate": "08/02/2017",
"AmountDue": "0",
"Status": "Paid"
},
I am trying to get the IssueDate and DueDate. Both are stored in the format dd/mm/yyyy. However whatever I do php seems to not be able to capture them consistently.
$report_starting_date=$item1['IssueDate'];
$report_starting_date=date('d/m/Y',strtotime($report_starting_date));
For the 2nd Item invoice (23) it works fine if I echo the month it will return 1 this seems to work as the date could be either dd/mm or mm/dd however in the 1st item invoice (13) 14 cannot be a month and so php seems to set the date as 01/01/1970. I have no idea why I can store one item correct and not the other?
Thanks