List of utility methods to do Date to Time
long | getTimeLocalWithoutDst(java.util.Date d) Get the number of milliseconds since 1970-01-01 in the local timezone, but without daylight saving time into account. return d.getTime() + CACHED_CALENDAR.get().get(Calendar.ZONE_OFFSET);
|
long | getTimeLocalWithoutDst(java.util.Date d) Get the number of milliseconds since 1970-01-01 in the local timezone, but without daylight saving time into account. Calendar calendar = getCalendar();
return d.getTime() + calendar.get(Calendar.ZONE_OFFSET);
|
long | getTimeMargin(String dateTime) get Time Margin int index = dateTime.indexOf(" "); String date = dateTime.substring(0, index); String time = dateTime.substring(index + 1); int dateSlash1 = date.indexOf("-"); int dateSlash2 = date.lastIndexOf("-"); if (dateSlash1 <= 0 || dateSlash1 == dateSlash2) return -1; int timeColon1 = time.indexOf(":"); ... |
Date | getTimeMax(Date date) get Time Max SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String da = sdf.format(date); da = da + " 23:59:59"; Date d = getStrToDate(DATE_FORMAT_1, da); return d; |
String | getTimeOfDate(Date date) This method is used for getting Calendar calStart = new GregorianCalendar(); calStart.setTime(date); String hour = String.valueOf(calStart.get(Calendar.HOUR_OF_DAY)); String zero = "0"; if (hour.length() < 2) { hour = zero.concat(hour); String min = String.valueOf(calStart.get(Calendar.MINUTE)); ... |
Date | getTimeOnly(Date date) get Time Only if (date == null) { return null; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.YEAR, 1970); calendar.set(Calendar.DAY_OF_YEAR, 1); return calendar.getTime(); ... |
Date | getTimeOnly(Date date) Returns time without date information. if (null == date) { date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.YEAR, 0); calendar.set(Calendar.MONTH, 0); calendar.set(Calendar.DAY_OF_MONTH, 0); ... |
Date | getTimeOnly(final Date oDate) get Time Only if (null == oDate) { return null; final Calendar c = Calendar.getInstance(); c.setTime(oDate); c.set(Calendar.YEAR, 1970); c.set(Calendar.MONTH, 0); c.set(Calendar.DAY_OF_MONTH, 1); ... |
Date | getTimePart(Date dateObject) get Time Part SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); Date timeWithoutDate = sdf.parse(sdf.format(dateObject)); return timeWithoutDate; |
String | getTimePeriod(Date date) get Time Period SimpleDateFormat _sdf = new SimpleDateFormat("aa"); String _value = _sdf.format(date); return _value; |