I'm trying to find a way to get the distance (in seconds) between two dates, the point is that i only have a method to convert seconds in date format, so like 350 seconds, 5 minutes and 50 seconds. my problem is that i can't find out a method to get distance in seconds between two dates, what i'm trying is to find the distance between the current date time (that can get by formatting currentTimeMillis) and 00:00 AM (of course of the next day)
Code (Text): Calendar tomorrow = Calendar.getInstance(); tomorrow.add( Calendar.DATE, 1 ); tomorrow.set( tomorrow.get( Calendar.YEAR ), tomorrow.get( Calendar.MONTH ), tomorrow.get( Calendar.DATE ), 0, 0, 0 ); Calendar now = Calendar.getInstance(); long difference = ( tomorrow.getTimeInMillis() - now.getTimeInMillis() ) / 1000L;