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

StringgetCurrentlyDateTime()
get Currently Date Time
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
return dateFormat.format(new Date());
longnow()
now
return Calendar.getInstance().getTimeInMillis();
StringgetTimeStamp()
get Time Stamp
return String.valueOf(System.currentTimeMillis() / 1000);
StringgetTimeString(long time)
get Time String
return dateFormat.format(new Date(time));
StringgetTimestamp()
get Timestamp
SimpleDateFormat sdf = new SimpleDateFormat(
        "[yyyy-MM-dd EEE HH:mm]");
return sdf.format(new Date());
longgetCurrentTime()
Get the current time in seconds since January 1, 1970
time.setToNow();
long now = time.toMillis(false) / 1000;
return now;
StringgetCurrentTime()
get Current Time
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String text = sdf.format(date);
return text;
StringgetCurrentTimeStamp()
get Current Time Stamp
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String text = sdf.format(date);
return text;
CalendargetNow()
get Now
Calendar c = Calendar.getInstance();
return c;
CalendargetNow()
get Now
GregorianCalendar now = new GregorianCalendar();
Calendar dateNow = new GregorianCalendar(now.get(Calendar.YEAR),
        now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
return dateNow;