0

There is a WebApi which was written by .Net and format DateTime on its JSON in this form:

"/Date(1511034890677+0330)/"

I'm getting this on Android and deserializing by Gson.

But the date is deserialize as a String. I'm able to parse the dateString to Java Date by SubString and add values together but is there a built-in class which can do the job on-the-fly e.g. by Gson or Java?

Edit 1: This is not duplicate of how to convert incoming Json date into java date format? as I mentioned in comments, I'm looking for a way to convert the date upon deserialization using Gson or Java.

mammadalius
  • 3,263
  • 6
  • 39
  • 47
  • 1
    Possible duplicate of [how to convert incoming Json date into java date format?](https://stackoverflow.com/questions/35473901/how-to-convert-incoming-json-date-into-java-date-format) – Ole V.V. Nov 28 '17 at 11:48
  • This question has been asked many times. Search for *java parse json date* or similar and find loads of answers faster than anyone can type one here. – Ole V.V. Nov 28 '17 at 11:49
  • @OleV.V. it's not duplicate of what you mentioned. Notice that I just write a parser with some SubStrings and looking for way to use Gson or Java to convert on-the-fly. – mammadalius Nov 28 '17 at 12:24
  • It’s a guess: could [this question](https://stackoverflow.com/questions/5671373/unparseable-date-1302828677828-trying-to-deserialize-with-gson-a-millisecond) help you? – Ole V.V. Nov 28 '17 at 12:40
  • You should search and research before asking, and then tell us what you found and in what way it was insufficient for solving your issue. It will give us a much better starting point for helping you. – Ole V.V. Nov 28 '17 at 12:41
  • 1
    I know how to use StackOverflow. The later link that you provide is near but not ENOUGH as it does not have TimeZone in the dateString. – mammadalius Nov 28 '17 at 12:45

0 Answers0