List of utility methods to do Minute Calculate
long | getTime(int minuteDelt) get Time return (new Date().getTime() + minuteDelt * 60000) / 1000; |
String | getTimeAddMinute(String time, int minute) get Time Add Minute ca.setTime(stdt(time));
ca.add(Calendar.MINUTE, minute);
return dtts(ca.getTime());
|
String | getTimeInDate(int offSetInMinutes) get Time In Date DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date dNow = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(dNow); calendar.add(Calendar.MINUTE, offSetInMinutes); dNow = calendar.getTime(); return dateFormat.format(dNow); |
String | getTravelTimeinMinutes(String startTime, String endTime) Calculates difference in minutes between two datetimes int diffMinutes = 0; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Date startDate = null, endDate = null; try { startDate = dateFormat.parse(startTime); endDate = dateFormat.parse(endTime); Calendar calStart = Calendar.getInstance(); calStart.setTime(startDate); ... |
String | minusMinutes(String s, long minutes) minus Minutes if (!s.contains(" ")) throw new Exception(); Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(s); long time = date.getTime() - (minutes * 10000L); date.setTime(time); SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); return sf.format(date); |
int | minuteBetween(Date smdate, Date bdate) minute Between Calendar cal = Calendar.getInstance(); cal.setTime(smdate); long time1 = cal.getTimeInMillis(); cal.setTime(bdate); long time2 = cal.getTimeInMillis(); long between_days = (time2 - time1) / (1000 * 60); return Integer.parseInt(String.valueOf(between_days)); |
int | minutesBetween(String from, String to, String format) minutes Between SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.UK); Calendar calendar = Calendar.getInstance(Locale.UK); calendar.setFirstDayOfWeek(Calendar.MONDAY); calendar.setMinimalDaysInFirstWeek(4); Date date1 = null; Date date2 = null; try { date1 = formatter.parse(from); ... |
String | minutesToHylaTime(int mins) minutes To Hyla Time String result; DecimalFormat fmt = new DecimalFormat("00"); result = fmt.format(mins % 60); mins /= 60; result = fmt.format(mins % 24) + result; mins /= 24; result = fmt.format(mins) + result; return result; ... |
Date | plusMinute(Date date, int minutes) plus Minute if (date == null) date = getToday(); return changeMinute(date, minutes); |
Date | plusMinute(int minute) plus Minute Calendar cal = Calendar.getInstance();
cal.add(Calendar.MINUTE, minute);
return cal.getTime();
|