List of utility methods to do Calendar to Date Convert
Date | Calendar2Date(Calendar c) Calendar Date return c.getTime();
|
String | getDate(Context context, Calendar calendar) get Date Calendar now = Calendar.getInstance(); long diff = now.getTimeInMillis() / 1000 - calendar.getTimeInMillis() / 1000; diff = diff < 0 ? 0 : diff; long years = diff / YEAR; long months = diff / MONTH; long weeks = diff / WEEKS; long days = diff / DAYS; ... |
HashMap | getDate(Calendar calendar) get Date final HashMap<String, Object> date = new HashMap<String, Object>(); date.put(YEAR, calendar.get(Calendar.YEAR)); date.put(MONTH, calendar.get(Calendar.MONTH) + 1); date.put(DAY, calendar.get(Calendar.DAY_OF_MONTH)); date.put(HOUR, calendar.get(Calendar.HOUR_OF_DAY)); date.put(MIN, calendar.get(Calendar.MINUTE)); return date; |