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

StringaddMinTime(long time, String addMin)
add Min Time
if (addMin.contains("m")) {
    addMin = addMin.replace("m", "");
long ad = Long.valueOf(addMin);
long i = ad * 60 * 1000;
return getDateByLongTime(time + i);
StringcalcTime(final long totalTime)
Calculate time from milliseconds
return totalTime / 60000 + ":" + timeFormat.format((totalTime % 60000) / 1000);
StringconvertLong2String(Long time, String format)
convert Long String
SimpleDateFormat formatter = new SimpleDateFormat(format);
Date myDate = new Date(time);
return formatter.format(myDate);
StringconvertLongDate(long lDate, String format)
convert Long Date
Date date = new Date(lDate);
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
return dateFormat.format(date);
StringconvertLongTimeStampToString(long localTimeStamp)
convert Long Time Stamp To String
Date dateTimeStamp = new Date(localTimeStamp);
String tempPattern = "yyyy-MM-dd a hh:mm"; 
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(tempPattern);
String stringTimeStamp = simpleDateFormat.format(dateTimeStamp);
return stringTimeStamp;
StringconvertLongTimeToText(Long time)
Convert custom field value to text form
if (time != null) {
    time /= 60; 
    return time.toString();
return null;
StringconvertLongToTimestampString(String dateFormat, Long millSec)
convert Long To Timestamp String
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
return sdf.format(millSec);
StringConvertLongToTimeString(long lastModified)
Convert Long To Time String
return toISO2616DateFormat(new Date(lastModified));
StringconvertMillisToHHMMSS(long millis)
convert Millis To HHMMSS
TimeZone tz = TimeZone.getTimeZone("UTC");
SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
df.setTimeZone(tz);
return df.format(new Date(millis));
StringconvertMillsToDateString(long currentTimeMillis)
convert Mills To Date String
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date(currentTimeMillis);
return formatter.format(date);