List of utility methods to do Time Get
String | getTimeStr(Date date) Returns "22:00" for param "2014-02-09 22:00" return HOUR_DATE_FORMAT.format(date);
|
String | getTimeString(String strTime) get Time String try { SimpleDateFormat formatter = new SimpleDateFormat( "yyyyMMddHHmmssSSSZ"); Date d = formatter.parse(strTime); DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); return df1.format(d); } catch (ParseException e) { return strTime; ... |
String | getNowDateTime() get Now Date Time Date date = new Date(); return formatDate(date); |
int | getTimeAsInt() get Time As Int Calendar cal = Calendar.getInstance(); java.text.SimpleDateFormat sdf = new SimpleDateFormat("HHmmss"); String cdate = sdf.format(cal.getTime()); return Integer.parseInt(cdate); |
Time | nowAsTime() now As Time Calendar objCurrentCalendar = Calendar.getInstance(); StringBuffer sbTimeString = new StringBuffer(); int iHourOfDay = objCurrentCalendar.get(Calendar.HOUR_OF_DAY); int iMinute = objCurrentCalendar.get(Calendar.MINUTE); int iSecond = objCurrentCalendar.get(Calendar.SECOND); sbTimeString.append(iHourOfDay); sbTimeString.append(":"); sbTimeString.append(iMinute); ... |
Calendar | getCurrentTimeCalendar() get Current Time Calendar Calendar calendar = Calendar.getInstance();
return calendar;
|
String | getCurrentTimeStr() get Current Time Str return getTimeStr(System.currentTimeMillis());
|
String | getCurrentTimeString() get Current Time String Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.HOUR_OF_DAY) + ":" + calendar.get(Calendar.MINUTE); |
String | getTime() get Time Calendar c = Calendar.getInstance(); int theHour = c.get(Calendar.HOUR_OF_DAY); int theMinute = c.get(Calendar.MINUTE); int theSecond = c.get(Calendar.SECOND); return (new Time(theHour, theMinute, theSecond)).toString(); |
String | getTime() get Time Calendar c = Calendar.getInstance(); int theHour = c.get(Calendar.HOUR_OF_DAY); int theMinute = c.get(Calendar.MINUTE); int theSecond = c.get(Calendar.SECOND); return (new Time(theHour, theMinute, theSecond)).toString(); |