How to convert a date into C# `/Date(1504020443813-0300)/` format for PHP?

Asked

Viewed 83 times

1

In some applications I use C#, when I return the value in JSON, the object DateTime is serialized to a weird format, more or less like this:

/Date(1504020443813-0300)/

And I’ll get it in PHP.

When I receive this value in PHP, I will need to convert it to the object DateTime.

So how can I convert this format there to DateTime PHP? Already have something native to PHP, or have to use regex or things like?

  • 1

    Is that https://stackoverflow.com/a/46120602/1518921 ? In case it converts to a format validated by "ISO" and pass via string, then PHP will understand in the use of Datetime ;)

  • 1

    https://answall.com/q/305454/112052

  • 1

    @hkotsubo essa seria melhor https://answall.com/a/285942/3635 - the answer you linked solves in PHP, which I found a disastrous solution

  • @Thiagomagalhães see my previous comment

  • 3

    Short solution: https://ideone.com/nFROOE

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.