Java Second Get getSecondsAsClock(int time)

Here you can find the source of getSecondsAsClock(int time)

Description

get Seconds As Clock

License

Open Source License

Declaration

public static String getSecondsAsClock(int time) 

Method Source Code

//package com.java2s;

public class Main {
    public static final int HOUR = 72000;
    public static final int MINUTE = 1200;
    public static final int SECOND = 20;

    public static String getSecondsAsClock(int time) {
        int hour = time * 20 / HOUR;
        int minute = (time * 20 - hour * HOUR) / MINUTE;
        int second = (time * 20 - hour * HOUR - minute * MINUTE) / SECOND;

        return String.format("%02d:%02d:%02d", hour, minute, second);
    }/*  w  w  w  .  ja  va2s  . c  o m*/
}

Related

  1. getSeconds(final double DEC_DEG)
  2. getSeconds(int minutes)
  3. getSeconds(String s)
  4. getSeconds(String time)
  5. getSeconds(String time, int defaultValue)
  6. getSecondsByDays(int days)
  7. getSecondsForShortString(String string)
  8. getSecondsFromEpoch()
  9. getSecondsFromHMS(String hmsvalue)