Java Second dateArrayFromSeconds(int inSeconds)

Here you can find the source of dateArrayFromSeconds(int inSeconds)

Description

Given a number of seconds, creates an int[] detailing the months, days, and hours difference as well.

License

Apache License

Return

int array

Declaration

public static int[] dateArrayFromSeconds(int inSeconds) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from   w  w  w.  j  av a 2s. c o m*/
     * Given a number of seconds, creates an int[] detailing the
     * months, days, and hours difference as well.
     * <p/>
     * 0: days<br>
     * 1: hours<br>
     * 2:minutes<br>
     * 3:seconds<br>
     *
     * @return int array
     */
    public static int[] dateArrayFromSeconds(int inSeconds) {
        int days = (int) (inSeconds / (60 * 60 * 24));
        inSeconds -= (days * 60 * 60 * 24);
        int hours = (int) (inSeconds / (60 * 60));
        inSeconds -= (hours * 60 * 60);
        int minutes = (int) (inSeconds / 60);
        inSeconds -= (minutes * 60);
        return new int[] { days, hours, minutes, inSeconds };
    }
}

Related

  1. asStringInSeconds(long duration)
  2. bytesPerSecond(long totalByteCount, long elapsed)
  3. calculateSeconds(long duration)
  4. countSecond(Long time)
  5. currentSecondsPlus(final long seconds)
  6. dateDiffToSeconds(final String diff)
  7. HoursToSeconds(final float hours)
  8. isSecondsWholeHour(long secs)
  9. second2time(int seconds)