json date object to php date

前端 未结 5 1273
不知归路
不知归路 2021-01-20 03:54

I am calling a webservice which return me back a json object. The json object encodes the date. I am trying to find a way to convert that date to m-d-Y format in php. Json

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-20 04:53

    You can use this package to parse the JSON dates:

    https://github.com/webapix/dot-net-json-date-formatter

    use \Webapix\DotNetJsonDate\Date;
    
    Date::toDateTime('/Date(387518400000-0400)/'); // return with \DateTime object
    

提交回复
热议问题