Java Utililty Methods Now

List of utility methods to do Now

Description

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

Method

StringcalNow()
cal Now
return calFormat(Calendar.getInstance());
intcompareDateWithNow(Date date1)
compare Date With Now
Date date2 = new Date();
int rnum = date1.compareTo(date2);
return rnum;
intcompareWithNow_2(String t)
compare With No_
SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT_2);
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
try {
    c1.setTime(formatter.parse(t));
    c2.setTime(new Date());
} catch (ParseException e) {
    e.printStackTrace();
...
StringformatNow()
format Now
return formatDateISO(new Date());
StringformatNow()
format Now
return formatDateISO(new Date());
StringformatNow()
Formats a Date into a date/time string.
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd-HH:mm:ss");
return format.format(new Date());
StringformatNow(String fmt)
format Now
return formatDate(new Date(), fmt);
StringformatNow(String pattern)
format Now
return new SimpleDateFormat(pattern).format(new Date());
StringformatNow(String style)
format Now
return new SimpleDateFormat(style).format(System.currentTimeMillis());
StringformatTime(Date now, String pattern)
format Time
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.format(now);