List of utility methods to do Long to Date Convert
String | getDate(long timeStamp) get Date try { SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy"); Date netDate = (new Date(timeStamp)); return sdf.format(netDate); } catch (Exception ex) { return ""; |
String | getDateFrom(long timestamp, Context context) get Date From if (timestamp <= 0) return ""; return DateFormat.getDateFormat(context).format( getDateFromLong(timestamp)); |
Date | getDateFromLong(long dateLong) get Date From Long if (dateLong == 0) { return null; return new Date(dateLong); |
String | getDateTimeString(long time_milis) get Date Time String SimpleDateFormat sdf = getSimpleDateFormat(); return sdf.format(new Date(time_milis)); |
String | formatTime(long timeInMillis) format Time return format(TIME_FORMAT, timeInMillis);
|
String | formatDate(long timeInMillis) format Date return format(DATE_FORMAT, timeInMillis);
|
String | getCurrentDate(long time) get Current Date DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); return dateFormat.format(time); |
String | changeMillisToFormat(long milliseconds, String pattern) change Millis To Format Date fecha = new Date(milliseconds); return changeDateToFormatString(fecha, pattern); |
String | convertLongToDateString(long mills, String format) convert Long To Date String SimpleDateFormat sdf = new SimpleDateFormat(format); String date = sdf.format(mills); return date; |
String | format(String pattern, long timeInMillis) format final SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(new Date(timeInMillis)); |