jeudi 7 janvier 2016

Find number of seconds between two datetime strings in android

            String start_time = cursor.getString(cursor
                    .getColumnIndex(STARTING_TIME));
            Log.d("timetracker","start time"+start_time);

            String stop_time = cursor.getString(cursor
                    .getColumnIndex(STOPPING_TIME));
            Log.d("timetracker","stop time"+stop_time);

in log i am getting this output for the above code

01-08 10:27:32.107: D/timetracker(29800): start time2016-01-07 14:36:28.000

01-08 10:27:32.107: D/timetracker(29800): stop time2016-01-07 14:36:40.000

01-08 10:27:32.107: D/timetracker(29800): start time2016-01-07 14:37:43.000

01-08 10:27:32.107: D/timetracker(29800): stop time2016-01-07 14:37:44.000

01-08 10:27:32.107: D/timetracker(29800): start time2016-01-07 14:38:26.000

01-08 10:27:32.107: D/timetracker(29800): stop time2016-01-07 14:38:27.000

i need to find difference btw start_time and stop_time eg: btw 2016-01-07 14:36:28.000 and 2016-01-07 14:36:40.000

Aucun commentaire:

Enregistrer un commentaire