Java Millisecond Convert millisecondsToDateTime(long timeMillis)

Here you can find the source of millisecondsToDateTime(long timeMillis)

Description

milliseconds To Date Time

License

Open Source License

Declaration

public static String millisecondsToDateTime(long timeMillis) 

Method Source Code

//package com.java2s;

public class Main {

    public static String millisecondsToDateTime(long timeMillis) {
        long day = timeMillis / (24 * 60 * 60 * 1000);
        long hour = (timeMillis / (60 * 60 * 1000) - day * 24);
        long min = ((timeMillis / (60 * 1000)) - day * 24 * 60 - hour * 60);
        long s = (timeMillis / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
        long sss = (timeMillis - day * 24 * 60 * 60 * 1000 - hour * 60 * 60 * 1000 - min * 60 * 1000 - s * 1000);
        return (day > 0 ? day + "," : "") + hour + ":" + min + ":" + s + "." + sss;
    }/*from  w w  w  .  j a va  2  s . c  o m*/
}

Related

  1. getTimeStr(final long millis)
  2. getTimeString(long millis)
  3. getTimeString(long timelnMillis)
  4. getTimeTakenAsSecondsString(long timeTakenMillis)
  5. millisecondConvertToStringTime(final long milliseconds)
  6. millisecondsToDays(long p_timeInMilliseconds, long p_secondsInDay)
  7. millisecondsToHHMMSS(long milliseconds)
  8. milliSecondsToHMS(long l)
  9. milliSecondsToHMS(long numMillis)