Java Utililty Methods Date Now

List of utility methods to do Date Now

Description

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

Method

ListgetDayToMonthEnd(boolean iscurrentdate)
get Day To Month End
List<String> list = new ArrayList<String>();
Calendar calendar = new GregorianCalendar();
int cday = calendar.get(Calendar.DAY_OF_MONTH);
int currentyear = calendar.get(Calendar.YEAR);
int currentmonth = calendar.get(Calendar.MONTH) + 1;
if (iscurrentdate) {
    list.add(getYearAndMonthAndDay(currentyear, currentmonth, cday));
int maxDate = getMaxDayByYearMonth(getCustomerDay("yyyy-MM"));
for (int i = cday + 1; i <= maxDate; i++) {
    list.add(getYearAndMonthAndDay(currentyear, currentmonth, i));
Collections.sort(list);
return list;
DategetNowDate()
get Now Date
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
StringgetNowDate()
return current date value in format: yyyy-MM-dd
return dateToStringWithPattern(new Date(), "yyyy-MM-dd");
StringgetNowDate()
get Now Date
return getFormatNowDateTime("yyyy-MM-dd");
StringgetNowDate()
get Now Date
Date nowDate = new Date();
Calendar now = Calendar.getInstance();
now.setTime(nowDate);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String str = formatter.format(now.getTime());
return str;
DategetNowDate()
get Now Date
date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String dateString = simpleDateFormat.format(date);
return date;
StringgetNowDate()
get Now Date
Date date = new Date();
int nowMonth = date.getMonth() + 1;
int nowYear = date.getYear() + 1900;
int day = date.getDate();
String startTime = nowYear + "-" + nowMonth + "-" + day;
return startTime;
StringgetNowDate()
Gets the now date.
GregorianCalendar gcNow = new GregorianCalendar();
java.util.Date dNow = gcNow.getTime();
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.SIMPLIFIED_CHINESE);
return df.format(dNow);
StringgetNowDate()
get Now Date
GregorianCalendar gcNow = new GregorianCalendar();
Date dNow = gcNow.getTime();
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.SIMPLIFIED_CHINESE);
return df.format(dNow);
StringgetNowDate(String format)
get Now Date
if (format == null) {
    return null;
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.JAPAN);
java.util.Date date = Calendar.getInstance().getTime();
if (date == null) {
    return null;
return sdf.format(date);