Hunsu
Hunsu

Reputation: 3391

What's the format of this Date

A web api that I use return this in the Json response :

"timestamp": "2014-12-30T15:54:19Z",

I use Jackson to map the response to object. I have this in my class

@JsonProperty("notificationtimestamp")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="", timezone="") //I don't know what to put here

My question what should I put in the JsonFromat annotation for pattern and timezone?

I'm thinking to put:

yyyy-MM-ddThh:mm:ssZ

Upvotes: 0

Views: 328

Answers (1)

PeterMmm
PeterMmm

Reputation: 24630

The docs said:

... pattern may contain SimpleDateFormat-compatible pattern definition.

Than the pattern should be

yyyy-MM-dd'T'hh:mm:ss'Z'

note the quotes.

Upvotes: 4

Related Questions