// Gets the day number of a date public int getDate(Date d) { Calendar ca = Calendar.getInstance();
ca.setTime(d); int days = ca.get(Calendar.DATE); return days; } // Before a given date / after n day
// n=-1 Indicates the previous day ,n=1 The next day public Date getDateForDayNum(Date date, int n) { Calendar
ca = Calendar.getInstance(); ca.setTime(date); ca.add(Calendar.DAY_OF_MONTH,
n); Date d = ca.getTime(); return d; } // Before a given date / after n month // n=-1 Indicates the previous month ,n=1 Indicates the next month
public Date getDateForMonthNum(Date date, int n) { Calendar ca =
Calendar.getInstance(); ca.setTime(date); ca.add(Calendar.MONTH, n); Date d =
ca.getTime(); return d; } // Front / Month after , Front / Date of the day after public Date getDateForMonthNum(Date
date, int Month,int day) { Calendar ca = Calendar.getInstance();
ca.setTime(date); ca.add(Calendar.MONTH, Month); ca.add(Calendar.DAY_OF_MONTH,
day); Date d = ca.getTime(); return d; } // Before a given date / after n year // n=-1 Indicates the previous year ,n=1 Indicates the following year
public Date getDateForYearNum(Date date, int n) { Calendar ca =
Calendar.getInstance(); ca.setTime(date); ca.add(Calendar.YEAR, n); Date d =
ca.getTime(); return d; } // Before a given date / after n hour // n=-1 Represents the previous hour ,n=1 It means the next hour public Date
getDateForHourNum(Date date, int n) { Calendar ca = Calendar.getInstance();
ca.setTime(date); ca.add(Calendar.HOUR, n); Date d = ca.getTime(); return d; }
// The last day of a month in a year public Date getLastDay(Date date) { Calendar ca =
Calendar.getInstance(); ca.setTime(date); ca.roll(Calendar.MONTH, 1);// Roll back one month
ca.set(Calendar.DATE, 0); Date time = ca.getTime(); return time; } // How many days are there in a month and year
public int getDateNumForDate(Date date) { Calendar ca = Calendar.getInstance();
ca.setTime(date); ca.roll(Calendar.MONTH, 1); ca.set(Calendar.DATE, 0); return
ca.get(Calendar.DATE); } // What day of the week is a month or a year ( Return on Sunday 0, Monday to Saturday 1-6) public int getWeek(Date
date) { Calendar ca = Calendar.getInstance(); int week =
ca.get(Calendar.DAY_OF_WEEK) - 1;// set up return week; }
 

Technology
©2019-2020 Toolsou All rights reserved,
One is called “ Asking for the train ” A small village Finally got the train SparkSQL Achieve partition overlay write Character recognition technology of vehicle license plate based on Neural Network c++ Memory Pointer out of bounds detection mechanism _CrtMemBlockHeade Change one's mind ! Tesla starts to deliver made in China to European market Model 3Qt study 7—— Modal and modeless dialog boxes JavaScript Medium Call and ApplyJAVA Convert a string to a numeric type k8s Entry to give up --k8s Key concepts Count the number of letters (java Language implementation )