Android Utililty Methods Time Format

List of utility methods to do Time Format

Description

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

Method

StringconvertDateTime(long date, String format)
convert Date Time
try {
    if (format == null) {
        format = DEFAULT_FORMAT_DATE;
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
    return simpleDateFormat.format(new Date(date));
} catch (Exception e) {
    e.printStackTrace();
...
DategetDateFromFormattedTimeStamp( String formattedTimeStamp)
get Date From Formatted Time Stamp
SimpleDateFormat date = new SimpleDateFormat(
        MARTUS_SIGNATURE_FILE_DATE_FORMAT);
return date.parse(formattedTimeStamp);
StringgetFormattedTimeStamp(long millisSince1970)
get Formatted Time Stamp
Timestamp stamp = new Timestamp(millisSince1970);
SimpleDateFormat formatDate = new SimpleDateFormat(
        MARTUS_SIGNATURE_FILE_DATE_FORMAT);
String dateStamp = formatDate.format(stamp);
return dateStamp;
StringgetRFC3339FormattedTime()
get RFC Formatted Time
Calendar calendar = getCurrentCalendar();
calendar.add(Calendar.HOUR_OF_DAY, -9);
SimpleDateFormat format = new SimpleDateFormat(
        "yyyy-MM-dd'T'HH:mm:ssz");
String result = format.format(calendar.getTime());
String standardName = "";
if (result.contains("JST")) {
    standardName = "JST";
...
Stringget_current_date_time_format1_str()
gecurrendattimformastr
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_FORMAT1);
return sdf.format(cal.getTime());
StringtimeFormatToString(int paramInt)
time Format To String
StringBuffer localStringBuffer = new StringBuffer();
int i = paramInt / 1000;
int j = i / 3600;
int l;
int i1;
if (j >= 10) {
    localStringBuffer.append(j);
} else {
...
StringtimeLongToHhmm(long timeMillis, DateFormat df)
time Long To Hhmm
Date d = new Date(timeMillis);
return df.format(d);
StringtoModifiedTimeString(Date modified)
to Modified Time String
long time = modified.getTime();
double timed = time / 1000.0;
String retval = String.format(Locale.ENGLISH, "%.2f", timed);
return retval;
longconvertDateTime(String date)
convert Date Time
return convertDateTime(date, null);
StringconvertDateTime(long date)
convert Date Time
return convertDateTime(date, null);