-3

I want to get the current time and convert it to JSON Format as shown below:

'2015-11-02T17:22:04.184+00:00'

The Date and DateFormat doesn't appear to have a method to do this.

Does anyone know how this can be done?

EDIT: This is not a duplicate question

The answer suggested does not get me the time and date in this format:

'2015-11-02T17:22:04.184+00:00'
Tunaki
  • 132,869
  • 46
  • 340
  • 423
DMC
  • 1,184
  • 5
  • 21
  • 50
  • 1
    Possible duplicate of [UTC time into Local TIme in Android](http://stackoverflow.com/questions/17677546/utc-time-into-local-time-in-android) – AGE Nov 05 '15 at 15:52

1 Answers1

0

What do you mean "JSON Format"?

JSON is just a string:value object (this is why people "-1" you). You can read about it here.

A JSON format would be { "date":"2015-11-02T17:22:04.184+00:00"}

To convert the date string to Java Date object you can use SimpleDateFormat. You can see some examples here

Asaf Pinhassi
  • 15,177
  • 12
  • 106
  • 130