List of utility methods to do Long to Date Convert
Date | getDateForMillis(final long tick) get Date For Millis final Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(tick); return cal.getTime(); |
String | getDateLabel(long date) get Date Label SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); return sdf.format(date); |
String | getDateString(long date, int style, Locale locale) get Date String DateFormat formatter = DateFormat.getDateInstance(style, locale);
return formatter.format(date);
|
String | getDateString(long time) get Date String Calendar date = Calendar.getInstance(); time = time * 1000; date.setTimeInMillis(time); SimpleDateFormat dateformat = new SimpleDateFormat( "yyyy-MM-dd HH:mm"); String dateString = dateformat.format(date.getTime()); return dateString; |
String | getDateTime(long microsecond) get Date Time return getFormatDateTime(new Date(microsecond), "yyyy-MM-dd HH:mm:ss"); |
String | getDateTime(long microsecond) get Date Time return getFormatDateTime(new Date(microsecond), "yyyy-MM-dd HH:mm:ss"); |
Date | getDateTimeForTimeZone(Long time) get Date Time For Time Zone Long sourceRelativelyGMT = time - TimeZone.getTimeZone(DEFAULT_TIMEZONE).getRawOffset(); Long targetTime = sourceRelativelyGMT + TimeZone.getDefault().getRawOffset(); Date date = new Date(targetTime); return date; |
String | getDateTimeLabel(long time) get Date Time Label SimpleDateFormat formatter = new SimpleDateFormat(DATE_TIME_FORMAT); return formatter.format(new Date(time)); |
String | getDateTimeString(long dateTime) get Date Time String SimpleDateFormat format = new SimpleDateFormat("HH:mm dd/MM/yy"); StringBuilder dateString = new StringBuilder( format.format(dateTime)); return dateString.toString(); |
String | getDateWeekLabel(long date) get Date Week Label SimpleDateFormat sdf = new SimpleDateFormat(DATE_WEEK_FORMAT); return sdf.format(date); |