Java Utililty Methods Today

List of utility methods to do Today

Description

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

Method

doubletoday()
today
java.util.Calendar dte = java.util.Calendar.getInstance();
dte.setTime(new java.util.Date());
return date(dte.get(java.util.Calendar.YEAR), dte.get(java.util.Calendar.MONTH) + 1,
        dte.get(java.util.Calendar.DATE));
Stringtoday()
today
return today(YYYYMMDD);
Stringtoday()
today
return formatDate(new Date(), "yyyy-MM-dd");
Stringtoday()
today
return dateToString(now(), DF_YMD);
Datetoday()
today
try {
    return new SimpleDateFormat(DATE_FORMAT).parse(formatDate(new Date()));
} catch (ParseException e) {
    e.printStackTrace();
    return null;
Stringtoday()
today
return datetimeToStr(new Date()).substring(0, 8);
DatetoDay(final String dateString)
Tries to interpret a given string as a day This routines assumes that all date parts of a day are present, time components are ignored.
if (dateString == null || dateString.trim().length() < 6)
    return null;
Locale[] locales = { Locale.getDefault(), Locale.UK, Locale.GERMANY };
for (Locale locale : locales) {
    if (!DAY_PATTERNS.containsKey(locale)) {
        List<SimpleDateFormat> patterns = new ArrayList<SimpleDateFormat>();
        for (String pattern : DAY_FORMATS) {
            patterns.add(new SimpleDateFormat(pattern, locale));
...
Stringtoday(String format)
today
Date date = Calendar.getInstance().getTime();
return new SimpleDateFormat(format).format(date);
Stringtoday(String pattern)
today
Calendar calendar = Calendar.getInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
return dateFormat.format(calendar.getTime());
Stringtoday(String strFormat)
today
return toString(new Date(), strFormat);