1

I have an object --> public timestamp date; which gives me a date like :

2012-08-07T07:47:46 - 0000+0....

but I want:

"2012-08-07T07:47:46Z"

How can I parse to json date iso 8601 with the "z" at the end?

David L
  • 32,885
  • 8
  • 62
  • 93
hamdalaye
  • 107
  • 1
  • 12

1 Answers1

1

You should look into Joda libraries, what you need is to convert ISO8061 to ISO8061 but with UTC timezone. Joda Docs

Alternatively DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")

Palcente
  • 625
  • 2
  • 7
  • 21
  • I use the second solution : Date myoldformatDate = new Date(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); String mynewformatDate =  df.format(date); Input : 2015-03-30T15:56:13-000-00.. Output : 2015-03-30T15:56:13Z Thank you for your help. – hamdalaye Apr 10 '15 at 09:56