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

intdayOfDate(Date s)
day Of Date
String d = FORMAT_YYYY_MM_DD.format(s);
return Integer.parseInt(d.substring(8, 10));
StringdayOfWeekAbr(Date date)
returns abbreviated day of week
if (date == null) {
    return "";
return new SimpleDateFormat("EEE").format(date);
StringdaysFrom(Date date, int amount, String format)
days From
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(daysFrom(date, amount));
DatedaysOfnumbe(Date sDate, int number)
days Ofnumbe
SimpleDateFormat sdf = new SimpleDateFormat(SHORT_TIME_FORMAT);
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, number);
return convertStringToDate(SHORT_TIME_FORMAT, sdf.format(c.getTime()));
intdaySub(Date fDate, Date oDate)
day Sub
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
long to = fDate.getTime();
long from = oDate.getTime();
return (int) (to - from) / (1000 * 60 * 60 * 24);
ListdaysWeekName(boolean shortName, Locale locale)
days Week Name
int fdow = 1;
DateFormatSymbols dfs = null;
if (locale != null) {
    fdow = Calendar.getInstance(locale).getFirstDayOfWeek();
    dfs = DateFormatSymbols.getInstance(locale);
} else {
    fdow = Calendar.getInstance().getFirstDayOfWeek();
    dfs = DateFormatSymbols.getInstance();
...
longdayToMilliSeconds(String day, String timeZone)
Convert String of day to epoch time for targeted time zone.
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone(timeZone));
return simpleDateFormat.parse(day).getTime();
longdayToUTCSeconds(String day)
Convert String of day to epoch time for UTC
return dayToSeconds(day, "UTC");
StringgetDateYYMMDD()
Renvoie la date courante sous le format "yyMMdd"
SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd");
Date currentTime = new Date();
String date = formatter.format(currentTime);
return date;
StringgetDateYYMMDD(java.util.Date date)
get Date YYMMDD
if (date == null)
    return "";
SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd");
String NDate = formatter.format(date);
return NDate;