Java Utililty Methods Day From

List of utility methods to do Day From

Description

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

Method

DatecalculateDate(Date startDay, int days)
calculate Date
Calendar cal = Calendar.getInstance();
cal.setTime(startDay);
cal.add(Calendar.DAY_OF_YEAR, days);
return cal.getTime();
longcalculatorStartTimeOnDay(Date date)
calculator Start Time On Day
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTimeInMillis();
longclearDay(long timeInMillis)
clear Day
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(timeInMillis);
cal.set(Calendar.MILLISECOND, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.HOUR_OF_DAY, 0);
return cal.getTimeInMillis();
booleanCompareDay(Date orgin, Date target)
Compare Day
long interval = target.getTime() - orgin.getTime();
return (int) (interval / (24 * 60 * 60 * 1000)) < OneDay;
DateconvertYYMMDDToDate(int y, int m, int d, boolean beginning_of_day)
convert YYMMDD To Date
if (m < 0 || m > 11)
    m = 0;
if (d < 0 || d > 30)
    d = 0;
GregorianCalendar c = new GregorianCalendar();
c.set(Calendar.YEAR, y);
c.set(Calendar.MONTH, m);
c.set(Calendar.DATE, d);
...
DatecreateInDays(final Date from, final int amount)
create In Days
final Calendar cal = Calendar.getInstance();
cal.setTime(from);
cal.add(Calendar.DATE, amount);
return cal.getTime();
Integerday(Integer time)
day
int day = (int) Math.floor(time / 86400);
return day;
intdayFromDateValue(long x)
Get the day of month from a date value.
return (int) (x & 31);
longdayNumberToTimestamp(short dateNumber)
day Number To Timestamp
return dateNumber * (1000L * 60 * 60 * 24);
intdays(int d)
days
return d * hours(24);