I'm writing a program in Java that reads in a JSON object
which looks like this:
{
"items_count":20,
"items":[
{
"type":"User",
"id":1234,
"username":"user1",
"has_url":false,
"record_count":1,
"created_at":"12 hours ago"
},
{
"type":"User",
"id":5678,
"username":"user2",
"has_url":false,
"record_count":1,
"created_at":"12 hours ago"
}
]
}
Using I'm able to use a JSON parser
to get the data.
My problem is that all the created_at
dates are relative,i've seen that Java used to have RelativeTime
and AbsoluteTime objects
, but neither seems to be able to turn a relative string into an absolute time.