Java Utililty Methods Time Now

List of utility methods to do Time Now

Description

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

Method

StringgetNowOfDateByFormat(String format)
get Now Of Date By Format
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat(format);
String dateStr = sdf.format(d);
return dateStr;
StringgetNowPatch()
this is a fix for all strange date format; it returns the NOW value.
java.util.Date d = new java.util.Date(System.currentTimeMillis());
DateFormat utcf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
String out = utcf.format(d);
return out;
StringgetNowSinceHour()
get Now Since Hour
Date now = new Date();
return getNowSinceHour(now);
StringgetNowStr()
get current date and time string
return format(new Date(), FORMAT_DATE_TIME);
StringgetNowStr()
get Now Str
return dateToStr();
StringgetNowStr()
get Now Str
return dateTimeFormatter2.format(new Date());
StringgetNowStrDateVerbose()
Gets "now" in verbose format.
SimpleDateFormat df = new SimpleDateFormat("yyyy.MMMMM.dd hh:mm:ss aaa z");
Calendar opDate = Calendar.getInstance();
df.setTimeZone(DEFAULT_TIME_ZONE);
return df.format(opDate.getTime());
StringgetNowString()
returns Now in String (HHMM format)
return getTodayInFormat("HHmm");
StringgetNowString()
return a string of todays date time suitable this is in more international form that the version above
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss"); 
final String dateText = sdf.format(new Date());
return dateText;
StringgetNowString(String pattern)
get Now String
return getDateFormat(pattern).format(getNow());