Java Utililty Methods Long Number to Date

List of utility methods to do Long Number to Date

Description

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

Method

Stringconvert(long number)
convert
if (number == 0) {
    return "zero";
String snumber = Long.toString(number);
String mask = "000000000000";
DecimalFormat df = new DecimalFormat(mask);
snumber = df.format(number);
int billions = Integer.parseInt(snumber.substring(0, 3));
...
intconvert(long time)
convert
if (time == Long.MAX_VALUE) {
    return Integer.MAX_VALUE;
if (time == Long.MIN_VALUE) {
    return Integer.MIN_VALUE;
int timeInSec = (int) (time / 1000);
return timeInSec - timeZeroInt;
...
Stringconvert(long value, double[] factors, String[] unites)
convert
long sign = value == 0 ? 1 : value / Math.abs(value);
int i = 0;
double tmp = Math.abs(value);
while (i < factors.length && i < unites.length && tmp > factors[i]) {
    tmp = tmp / factors[i++];
tmp *= sign;
String result;
...
String[]convert(Long[] targets)
convert
if (targets == null) {
    return new String[0];
List<String> list = new ArrayList<String>();
for (Long target : targets) {
    list.add(target.toString());
return list.toArray(new String[0]);
...
longconvert2long(String date, String format)
convertlong
try {
    SimpleDateFormat sf = new SimpleDateFormat(format);
    return sf.parse(date).getTime();
} catch (ParseException e) {
    e.printStackTrace();
return 0l;
StringconvertDate(long datenum)
convert Date
Date date = new Date(datenum);
SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
return df.format(date);
StringconvertDate(long millisecs)
Converts the time from milliseconds to human-readable format
SimpleDateFormat date_format = new SimpleDateFormat(flameDateFormat);
Calendar c = Calendar.getInstance();
c.setTimeInMillis(millisecs);
return date_format.format(c.getTime());
StringconvertDate(long timestamp)
convert Date
return new SimpleDateFormat("yyyy-MM-dd").format(new Date(timestamp));
StringconvertDate(Long uTime, SimpleDateFormat dateFormat)
convert Date
Date date = new Date(uTime);
return dateFormat.format(date);
StringconvertDateFromLong(Long val)
convert Date From Long
Date date = new Date(val);
SimpleDateFormat df2 = new SimpleDateFormat("dd/MM/yy");
String dateText = df2.format(date);
return dateText;