Java Utililty Methods Year Day

List of utility methods to do Year Day

Description

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

Method

intgetYearWeek(String curday)
get Year Week
try {
    java.util.Date date = str2date(curday);
    Calendar rightNow = Calendar.getInstance();
    rightNow.setTime(date);
    return rightNow.get(Calendar.WEEK_OF_YEAR);
} catch (Exception e) {
    e.printStackTrace();
    return 0;
...
intgetYearWeek(String curday)
get Year Week
try {
    java.util.Date date = str2utilDate(curday);
    Calendar rightNow = Calendar.getInstance();
    rightNow.setTime(date);
    return rightNow.get(Calendar.WEEK_OF_YEAR);
} catch (Exception e) {
    System.out.println("DateUtil.getYearWeek(str) Error:e = " + e);
    return 0;
...
intlastDay(Integer year, int month)
last Day
Calendar cal = Calendar.getInstance();
cal.set(year, month - 1, 1);
cal.add(Calendar.MONTH, 1);
cal.add(Calendar.DATE, -1);
return cal.get(Calendar.DAY_OF_MONTH);
Stringlastdayofyear()
lastdayofyear
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
String year = sdf.format(new java.util.Date());
return year + "-12-31";
DatelastDayOfYear(Integer year)
last Day Of Year
Date d = new Date();
d.setMonth(11);
d.setYear(year - 1900);
d.setHours(23);
d.setMinutes(59);
Calendar calendar = Calendar.getInstance();
calendar.setTime(d);
int lastDate = calendar.getActualMaximum(Calendar.DATE);
...
StringtodaysYear()
todays Year
DateFormat nuSE = new SimpleDateFormat("yyyy");
return nuSE.format(new Date());