|
Anyframe Core | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectanyframe.common.util.DateUtil
public abstract class DateUtil
Date Utility Class
This is used to manage Date Object.
| Method Summary | |
|---|---|
static String |
calendar2String(Calendar calendar)
convert java.util.Calendar to String |
static String |
date2String(Date date)
convert java.util.Date to String type |
static String |
date2String(Date date,
String format)
convert java.util.Date to String type |
static boolean |
equals(Date date1,
Date date2)
Compares two dates for equality. |
static boolean |
equals(Date date1,
String date2)
Compares two dates for equality. |
static boolean |
equals(Date date1,
String date2,
String date2format)
Compares two dates for equality. |
static String |
getCurrentDay()
get current day |
static String |
getCurrentHour()
get current hour |
static String |
getCurrentTime()
get current system time |
static String |
getCurrentTime(String format)
get current time with date format |
static String[] |
getDates(String startDay,
String endDay)
find dates between startDay and endDay |
static String[] |
getDates(String startDay,
String endDay,
String format)
find dates between startDay and endDay |
static int |
getDays(Calendar cal1,
Calendar cal2)
It returns the number of days between two Gregorian Calendar dates (e.g. |
static int |
getDays(String date1,
String date2)
It returns the number of days between two string type dates. |
static String |
getDefaultDatePattern()
Return default datePattern (yyyy-MM-dd) |
static String |
getEndDate(String startDay,
int intervalDays)
getting end date intervalDays <= 40 |
static int |
getMinutes(Calendar cal1,
Calendar cal2)
It returns the number of minutes between two Gregorian Calendar dates |
static int |
getMinutes(String date1,
String date2)
It returns the number of minutes between two string type dates. |
static String |
getThisMonth()
get this month including this year |
static String |
getThisYear()
get this year |
static String |
getYesterday()
get yesaterday |
static String |
getYesterday(String format)
get yesaterday with format |
static boolean |
greaterThan(Date date1,
Date date2)
Compares two Dates for ordering. |
static boolean |
greaterThan(Date date1,
String date2)
Compares two Dates for ordering. |
static boolean |
greaterThan(Date date1,
String date2,
String date2format)
Compares two Dates for ordering. |
static Calendar |
string2Calender(String str)
convert String to java.util.Calendar |
static Date |
string2Date(String str)
convert String to java.util.Date |
static Date |
string2Date(String str,
String format)
convert String to java.util.Date |
static Date |
string2SQLDate(String date)
convert String to java.sql.Date type |
static Date |
string2SQLDate(String date,
String format)
convert String to java.sql.Date type |
static Timestamp |
string2Timestamp(String str)
convert String to java.sq.Timestamp |
static Timestamp |
string2Timestamp(String str,
String format)
convert String to java.sq.Timestamp |
static String |
timestamp2String(Timestamp date)
convert java.sql.Timestamp to String type |
static String |
timestamp2String(Timestamp date,
String format)
convert java.sql.Timestamp to String type |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String getEndDate(String startDay,
int intervalDays)
startDay - start day (yyyy-MM-dd)intervalDays - interval days
public static String getDefaultDatePattern()
public static boolean greaterThan(Date date1,
String date2)
date1 - Date to be compared.date2 - another Date String to be compared. (yyyy-MM-dd)
public static boolean greaterThan(Date date1,
String date2,
String date2format)
date1 - Date to be compared.date2 - another Date String to be compared. (The format equals
date2format that input argument)date2format - String date format
public static boolean greaterThan(Date date1,
Date date2)
date1 - Date to be compared.date2 - another Date to be compared.
public static boolean equals(Date date1,
String date2)
date1 - the Date to compare with.date2 - the other Date String to compare with. (yyyy-MM-dd)
public static boolean equals(Date date1,
String date2,
String date2format)
date1 - the Date to compare with.date2 - the other Date String to compare with. (The format equals
date2format that input argument)date2format - String Date format
public static boolean equals(Date date1,
Date date2)
date1 - the Date to compare with.date2 - the other Date to compare with.
public static Date string2SQLDate(String date)
throws Exception
date - the String Date to be converted (yyyy-MM-dd)
Exception - fail to convert string to SQLDate
public static Date string2SQLDate(String date,
String format)
throws Exception
date - the String Date to be convertedformat - date format to be converted.
Exception - fail to convert String to java.sql.Datepublic static String date2String(Date date)
date - the Date to be converted
public static String date2String(Date date,
String format)
date - the Date to be convertedformat - converted date format
public static Date string2Date(String str)
str - the String Date to be converted (yyyy-MM-dd)
public static Date string2Date(String str,
String format)
str - the String Date to be converted (The format equals format that
input argument)format - converted date format
public static Timestamp string2Timestamp(String str,
String format)
str - the String Date to be converted (The format equals format that
input argument)format - converted date format
public static Timestamp string2Timestamp(String str)
str - the String Date to be converted (yyyy-MM-dd)
public static String timestamp2String(Timestamp date)
date - the Date to be converted
public static String timestamp2String(Timestamp date,
String format)
date - the Date to be converted (The format equals format that input
argument)format - Date format
public static Calendar string2Calender(String str)
str - the String Date to be converted (yyyyMMddHHmmss)
public static String calendar2String(Calendar calendar)
calendar - the Calendar to be converted
public static int getMinutes(Calendar cal1,
Calendar cal2)
cal1 - the Calendar to calculatecal2 - another Calendar to calculate
public static int getMinutes(String date1,
String date2)
date1 - the String Date to calculate (yyyyMMddHHmmss)date2 - another String Date to calculate (yyyyMMddHHmmss)
public static int getDays(Calendar cal1,
Calendar cal2)
cal1 - the Calendar to calculatecal2 - another Calendar to calculate
public static int getDays(String date1,
String date2)
date1 - the String Date to calculate (yyyyMMddHHmmss)date2 - another String Date to calculate (yyyyMMddHHmmss)
public static String getCurrentTime()
public static String getCurrentTime(String format)
format - Date format
public static String getCurrentDay()
public static String getThisMonth()
format - Date format
public static String getThisYear()
public static String getCurrentHour()
public static String getYesterday()
public static String getYesterday(String format)
format - Date format
public static String[] getDates(String startDay,
String endDay)
startDay - start day (yyyy-MM-dd)endDay - end day (yyyy-MM-dd)
public static String[] getDates(String startDay,
String endDay,
String format)
startDay - start dayendDay - end dayformat - date format
|
Anyframe Core | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||