Java Utililty Methods Long Number to Time

List of utility methods to do Long Number to Time

Description

The list of methods to do Long Number to Time are organized into topic(s).

Method

longconvertTime(long difference)
convert Time
return (System.currentTimeMillis() + difference);
StringconvertTime(long time)
Method description
String suffix = "ms";
if (time > 1000) {
    time /= 1000;
    suffix = "s";
    if (time > 60) {
        time /= 60;
        suffix = "m";
        if (time > 60) {
...
StringconvertTime(Long time)
convert Time
long timelong = time.longValue();
if (timelong == 0) {
    return TIME_FORMAT;
if (timelong > 0) {
    long h = 0, hh = 0;
    long m = 0, mm = 0;
    long s = 0;
...
StringconvertTime(long time)
convert Time
Date date = new Date(time);
Format format = new SimpleDateFormat("yyyy MM dd HH:mm:ss");
return format.format(date).toString();
StringconvertTime(long time)
convert Time
int ms1 = (int) time;
int secs = ms1 / 1000;
int mins = secs / 60;
int hours = mins / 60;
hours %= 24;
secs %= 60;
mins %= 60;
ms1 %= 1000;
...
StringconvertTime(long time)
convert Time
double h = time / 3600000.0;
double m = (h - Math.floor(h)) * 60.0;
double s = (m - Math.floor(m)) * 60;
return String.format("%s%02d:%02d", (((int) h > 0) ? String.format("%02d:", (int) h) : ""), (int) m,
        (int) s);
StringconvertTime(long value)
convert Time
return convert(value, timeFactors, timeUnites);
StringconvertTime(long x)
Takes a time in milliseconds and converts to a string to be printed.
x /= 1000;
return String.format("%dh%02dm%02ds", x / 3600, (x / 60) % 60, x % 60);
longconvertTimestampToSec(long timestampInMs)
Converts specified timestamp in milliseconds to seconds.
return Math.round(timestampInMs / 1000d);
StringconvertTimestampToUTCString(final long aTimestamp)
convert Timestamp To UTC String
return UTCSimpleDateFormat.format(new Date(aTimestamp));