Java Time Format formatTime(float seconds)

Here you can find the source of formatTime(float seconds)

Description

format Time

License

Open Source License

Declaration

public static String formatTime(float seconds) 

Method Source Code

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

public class Main {
    public static String formatTime(float seconds) {
        int s = (int) (seconds % 60);
        int ms = (int) (seconds % 1 * 100);
        int m = (int) (seconds / 60);

        if (m > 0) {
            return String.format("%d:%d.%d", m, s, ms);
        }/*from  ww w  .  java2 s.co  m*/

        return String.format("%d.%d", s, ms);
    }
}

Related

  1. formatTime(double totalTime)
  2. formatTime(final int timeSec)
  3. formatTime(final long time)
  4. formatTime(final long time)
  5. formatTime(final long timeMS)
  6. formatTime(int minutes)
  7. formatTime(int minutes)
  8. formatTime(int originalTime)
  9. formatTime(int seconds)