This question already has an answer here:
- Datetime in PHP Script 3 answers
I am querying some data from MSSQL server using a web service which I have written. I get the values in JSON format. In order to convert data table to json string I use System.Web.Script.Serialization.JavaScriptSerializer
class. I have a date field which is turned into a long integer between the paranthesis.
...,"startDate":"\/Date(1387231200000)\/",...
When I try to convert this value to date string using gmdate()
function,
$sDate = gmdate("d/m/Y", preg_replace('/\D/','',$jsonArray['startDate']));
I get 18/08/1968 result. But the actual value in DB is 17.12.2013 00:00:00.
I also tried
$sDate = gmdate("d/m/Y", "1387231200000");
still returns 18/08/1968.
</div>