Java TimeUnit Usage getSecondsDateDiff(Date dateStart)

Here you can find the source of getSecondsDateDiff(Date dateStart)

Description

get Seconds Date Diff

License

Open Source License

Declaration

public static long getSecondsDateDiff(Date dateStart) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;

public class Main {
    public static long getSecondsDateDiff(Date dateStart) {
        Calendar cal = Calendar.getInstance();

        Date dateEnd = cal.getTime();

        long diffInMillies = dateEnd.getTime() - dateStart.getTime();

        TimeUnit timeUnit = TimeUnit.SECONDS;

        return timeUnit.convert(diffInMillies, TimeUnit.MILLISECONDS);
    }/*from   w w  w  .  j av a2  s.  c o  m*/
}

Related

  1. getQuantilesString(final Map quantilesValues)
  2. getRandomDate()
  3. getReadableElapsedIntervalInSeconds(final long elapsedTimInMillis)
  4. getRemainingTimeString(int completedCount, int totalCount, long elapsed)
  5. getSeconds(long time)
  6. getSecondsTimeStamp()
  7. getTime()
  8. getTimeComparisonEpsilonMicros()
  9. getTimeDifference(Date startDate, Date endDate)