List of utility methods to do Year Offset Get
double | deltaTimeCurrentCentury(int year) Calculates the difference between the Universal Time and the Terrestrial Time (also known as Dynamical Time) given a year within the 21st century. double t = (double) (year - 2000) / 100; return (102 + 102 * t + 25.3 * t * t + (year - 2100) * 0.37); |
boolean | hasYearPassed(int year) has Year Passed int normalized = normalizeYear(year); Calendar now = Clock.getCalendarInstance(); return normalized < now.get(Calendar.YEAR); |
Date | yearOffset(Date date, int offset) year Offset return offsetDate(date, Calendar.YEAR, offset);
|
String | getOneYearAgo() get One Year Ago DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, -365); return dateFormat.format(cal.getTime()); |
int | yearDays(int y) year Days int i, sum = 348; for (i = 0x8000; i > 0x8; i >>= 1) { if ((lunarInfo[y - 1900] & i) != 0) sum += 1; return (sum + leapDays(y)); |
String | getYearMonthDay1() get Year Month Day java.sql.Date date2 = new java.sql.Date(System.currentTimeMillis()); return date2.toString(); |
String | getYearMonthDay2() get Year Month Day java.util.Date date1 = new java.util.Date(); java.sql.Date date3 = new java.sql.Date(date1.getTime()); return date3.toString(); |
String | getYear_Second1() get Yea Second Timestamp stamp1 = new Timestamp(System.currentTimeMillis()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String timeStr = sdf.format(stamp1); return timeStr; |
String | getYear_Second2() get Yea Second java.util.Date date1 = new java.util.Date(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String timeStr2 = df.format(date1); return timeStr2; |