1

I have this problem, where I want to extract some data out of an arraylist. My arraylist looks like this:

List<String> allDate_time = new ArrayList<String>();

What my code is doing with this arraylist, is that I pull some data out of JSON and I store it in this arraylist. As you can see here:

JSONObject date_timeArray = json2.getJSONObject( 0 );

String date_time = date_timeArray.getString( "date_time" );

allDate_time.add( date_time );

What I'm receiving when I try to pull data out of the arraylist, by doing this:

dateView = (TextView) findViewById( R.id.dateTX );

dateView.setText( allDate_time.get( 0 ) );

Then I get a value like this which looks like this:

2018-03-18T01:39:45+01:00

Is there anyway, that I can extract only the date? So that when I setText, the value will only be

2018-03-18

And then, I can make another call setText giving me the value of time:

01:39:45

Latika Agarwal
  • 973
  • 1
  • 6
  • 11
Buster3650
  • 470
  • 2
  • 8
  • 19
  • 4
    Possible duplicate of [Parse a date-time string in ISO 8601 format without offset-from-UTC](https://stackoverflow.com/questions/37649735/parse-a-date-time-string-in-iso-8601-format-without-offset-from-utc) – leonardkraemer May 31 '18 at 17:33

0 Answers0