Android Utililty Methods Calendar Get

List of utility methods to do Calendar Get

Description

The list of methods to do Calendar Get are organized into topic(s).

Method

StringGetCurrentTime_String()
Get Current Tim String
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
String curentDateandTime = sdf.format(new Date());
return curentDateandTime;
longGetCurrentTime_UTCMilliSeconds()
Get Current TimUTC Milli Seconds
Calendar c = Calendar.getInstance();
return c.getTimeInMillis();
intGetCurrentTime_UTCSeconds()
Get Current TimUTC Seconds
Calendar c = Calendar.getInstance();
int seconds = c.get(Calendar.SECOND);
return seconds;
intgetCurrentMonth()
get Current Month
Calendar calendar = new GregorianCalendar();
calendar.setTime(new Date());
return calendar.get(Calendar.MONTH) + 1;
StringgetCurrentTimeStr()
get Current Time Str
SimpleDateFormat dateFormat = new SimpleDateFormat(
        PARSE_DATE_FORMAT);
Date d = new Date(System.currentTimeMillis());
return dateFormat.format(d);
StringgetCurrentWeek()
get Current Week
return getWeek(Calendar.getInstance());
intgetCurrentWeek()
get Current Week
Calendar cal = Calendar.getInstance();
return cal.get(Calendar.WEEK_OF_YEAR);
intgetCurrentWeek(Calendar cal)
get Current Week
if (cal == null) {
    cal = Calendar.getInstance();
return cal.get(Calendar.WEEK_OF_YEAR);
intgetDate()
get Date
return cal().get(Calendar.DAY_OF_MONTH);
StringgetDate()
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;