Android Utililty Methods Time Get

List of utility methods to do Time Get

Description

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

Method

StringgetFormatTime(Date date)
get Format Time
return getFormatDateTime(date, "yyyy-MM-dd HH:mm:ss");
StringgetCurTimeByFormat(String format)
get Cur Time By Format
Date newdate = new Date(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(newdate);
StringgetCurTimeByFormat(String format)
get Cur Time By Format
Date newdate = new Date(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(newdate);
StringgetCurrentTime(String dateFormat)
Returns current time with default `DATE_FORMAT`
return formatDate(Calendar.getInstance().getTime(), dateFormat);
DategetDate(String time)
get Date
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
try {
    date = format.parse(time);
} catch (ParseException e) {
    e.printStackTrace();
return date;
...
DategetDate(String time)
get Date
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
try {
    date = format.parse(time);
} catch (ParseException e) {
    e.printStackTrace();
return date;
...
StringgetDateLabel(long time)
get Date Label
SimpleDateFormat sdf = new SimpleDateFormat(
        SettingsFormatUtils.getDateFormat());
return sdf.format(new Date(time));
StringgetDateTime()
get Date Time
SimpleDateFormat dateFormat = new SimpleDateFormat(DATABASEFORMAT,
        Locale.getDefault());
Date date = new Date();
return dateFormat.format(date);
StringgetDateTime(String format)
get Date Time
SimpleDateFormat dateFormat = new SimpleDateFormat(format,
        Locale.getDefault());
Date date = new Date();
return dateFormat.format(date);
DateTimegetDateTimeFromCal(Calendar cal)
get Date Time From Cal
DateTime dateTime = new DateTime();
dateTime.year = cal.get(Calendar.YEAR);
dateTime.month = cal.get(Calendar.MONTH) + 1;
dateTime.day = cal.get(Calendar.DAY_OF_MONTH);
dateTime.hour = cal.get(Calendar.HOUR_OF_DAY);
dateTime.minute = cal.get(Calendar.MINUTE);
return dateTime;