List of utility methods to do Long to Date Convert
String | timestampToIso8601Str(long timestamp) timestamp To Iso Str return javaDateToIso8601(timestampToDate(timestamp));
|
String | timestampToIso8601Str(long timestamp) timestamp To Iso Str return javaDateToIso8601(timestampToDate(timestamp));
|
Calendar | toCalendar(long hour) to Calendar Calendar calNow = Calendar.getInstance();
Calendar calSet = (Calendar) calNow.clone();
calSet.set(Calendar.HOUR_OF_DAY, calNow.get(Calendar.HOUR_OF_DAY));
calSet.set(Calendar.MINUTE, calNow.get(Calendar.MINUTE));
calSet.set(Calendar.SECOND, calNow.get(Calendar.SECOND) + 3);
calSet.set(Calendar.MILLISECOND, 0);
return calSet;
|
String | toDateString(long seconds) to Date String return formatter.format(new Date(seconds * 1000L)); |
String | toFullDate(long timestamp) Convert a timestamp from the system timezone to "yyyy-mm-dd HH:mm:ss" Date date = new Date(timestamp); return toFullDate(date); |
String | toIso8601(long date, boolean utc) Formats a date / time according to the ISO 8601 format, optionally forcing to UTC. if (utc) { return DATE_FORMAT_ISO8601_UTC.format(date); return DATE_FORMAT_ISO8601.format(date); |
double | toJulianDay(long epochMillis) Calculates the astronomical Julian Day for an instant. double epochDay = epochMillis / 86400000d; return epochDay + 2440587.5d; |
long | toJulianDayNumber(long epochMillis) Calculates the astronomical Julian Day Number for an instant. return (long) Math.floor(toJulianDay(epochMillis) + 0.5d); |
String | toString(Long datetime) to String String result = new SimpleDateFormat("yyyyMMddHHmmss") .format(new Date(datetime)); return result; |
String | toTimeString(long milliseconds) to Time String long secs = milliseconds / 1000; long mins = secs / 60; long hours = mins / 60; secs = secs % 60; mins = mins % 60; if (hours > 0) { return String.format("%d:%02d:%02d", hours, mins, secs); return String.format("%d:%02d", mins, secs); |