Here you can find the source of convertSeconds(String sStartSeconds, String sEndSeconds)
Parameter | Description |
---|---|
seconds | a parameter |
public static String convertSeconds(String sStartSeconds, String sEndSeconds)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from www .j av a 2 s . c o m*/ * Convert the seconds into format like: 00:00:08,200 --> 00:00:12,200 * * @param seconds * @return */ public static String convertSeconds(String sStartSeconds, String sEndSeconds) { double dStartSeconds = Double.parseDouble(sStartSeconds); double dEndSeconds = Double.parseDouble(sEndSeconds); return String.format("%s --> %s", innerConvert(dStartSeconds), innerConvert(dEndSeconds)); } private static String innerConvert(double dSeconds) { int hours = (int) (dSeconds / 3600); int minutes = (int) ((dSeconds - 3600 * hours) / 60); int seconds = (int) (dSeconds % 60); int decimals = (int) ((dSeconds - (int) dSeconds) * 1000); return String.format("%02d:%02d:%02d,%03d", hours, minutes, seconds, decimals); } }