List of utility methods to do Calendar Get
String | GetCurrentTime_String() Get Current Tim String SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); String curentDateandTime = sdf.format(new Date()); return curentDateandTime; |
long | GetCurrentTime_UTCMilliSeconds() Get Current TimUTC Milli Seconds Calendar c = Calendar.getInstance();
return c.getTimeInMillis();
|
int | GetCurrentTime_UTCSeconds() Get Current TimUTC Seconds Calendar c = Calendar.getInstance(); int seconds = c.get(Calendar.SECOND); return seconds; |
int | getCurrentMonth() get Current Month Calendar calendar = new GregorianCalendar(); calendar.setTime(new Date()); return calendar.get(Calendar.MONTH) + 1; |
String | getCurrentTimeStr() get Current Time Str SimpleDateFormat dateFormat = new SimpleDateFormat( PARSE_DATE_FORMAT); Date d = new Date(System.currentTimeMillis()); return dateFormat.format(d); |
String | getCurrentWeek() get Current Week return getWeek(Calendar.getInstance());
|
int | getCurrentWeek() get Current Week Calendar cal = Calendar.getInstance();
return cal.get(Calendar.WEEK_OF_YEAR);
|
int | getCurrentWeek(Calendar cal) get Current Week if (cal == null) { cal = Calendar.getInstance(); return cal.get(Calendar.WEEK_OF_YEAR); |
int | getDate() get Date return cal().get(Calendar.DAY_OF_MONTH);
|
String | getDate() get Date in format "yyyy-MM-dd HH:mm:ss" Calendar cal = Calendar.getInstance(); java.text.SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); String cdate = sdf.format(cal.getTime()); return cdate; |