Pleasure
Pleasure

Reputation: 319

How to convert json datatime object to string in java 8

I have an application, when I run it on liberty server the localdatetime works fine as a string e.g "2017-05-27T22:14:30" but when I run the same application on websphere server the localdatetime displays as object, e.g as below:

"wrongDate" : {
    "year" : 2017,
    "month" : "MAY",
    "dayOfMonth" : 1,
    "dayOfWeek" : "MONDAY",
    "dayOfYear" : 33,
    "monthValue" : 5,
    "hour" : 22,
    "minute" : 14,
    "second" : 0,
    "nano" : 1122336,
    "chronology" : {
      "id" : "ISO",
      "calendarType" : "iso8601"
    }
  }

I used this: DateTimeFormatter formatDate = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")

Does servers format date differently and how could I work around this issue.

Upvotes: 0

Views: 41

Answers (0)

Related Questions