Java Utililty Methods Day

List of utility methods to do Day

Description

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

Method

StringdateValue(Date d)
date Value
return sdf.format(d);
longday2Day(String startDate, String endDate, String format)
day Day
if (format == null)
    format = "yyyy/MM/dd HH:mm:ss.SSS";
SimpleDateFormat sdf = new SimpleDateFormat(format);
Date sDate;
Date eDate;
long day2day = 0;
try {
    sDate = sdf.parse(startDate);
...
Stringday2ThuesDay(Date date)
day Thues Day
Calendar calendar = Calendar.getInstance();
calendar.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
calendar.setTime(date);
int week = calendar.get(Calendar.DAY_OF_WEEK);
if (week == Calendar.MONDAY || week == Calendar.SUNDAY) {
    week += 7;
calendar.add(Calendar.DAY_OF_MONTH, -week);
...
longdayDiff(Date date1, String date2)
day Diff
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long diff = 0l;
try {
    long d1 = date1.getTime();
    long d2 = sdf.parse(date2).getTime();
    diff = (Math.abs(d1 - d2) / (1000 * 60));
} catch (ParseException e) {
    e.printStackTrace();
...
DatedayEnd(Date date)
day End
if (date == null)
    return null;
DateFormat dayGranularity = new SimpleDateFormat("ddMMyyyy");
DateFormat secondGranularity = new SimpleDateFormat("ddMMyyyy:HHmmss");
String today = dayGranularity.format(date);
try {
    return secondGranularity.parse(today + ":235959");
} catch (ParseException e) {
...
DatedayFillter(String text, String type)
day Fillter
SimpleDateFormat format = new SimpleDateFormat(type);
try {
    return format.parse(text);
} catch (ParseException e) {
    e.printStackTrace();
return getTimezoneDate(_DEFAULT_TIMEZON);
DatedayFillter(String text, String type)
day Fillter
SimpleDateFormat format = new SimpleDateFormat(type);
try {
    return format.parse(text);
} catch (ParseException e) {
    e.printStackTrace();
return new Date();
DatedayFilter(Date date)
day Filter
SimpleDateFormat format = new SimpleDateFormat(_8DIGIT_DATE_1);
return dayFilter(format.format(date));
intdayForAMorPM(String date)
day For A Mor PM
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date dateparam = null;
try {
    dateparam = format.parse(date);
} catch (ParseException e) {
    e.printStackTrace();
Calendar calendar = Calendar.getInstance();
...
StringdayFormat(Date date)
day Format
return new SimpleDateFormat("yyyyMMdd").format(date);