Package com.jk.core.util
Class JKDateTimeUtil
java.lang.Object
com.jk.core.util.JKDateTimeUtil
The Class JKDateTimeUtil.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Date
adddDaysToCurrentDate
(int numberOfDays) Addd days to current date.static Date
adddMonths
(int numOfMonths) Addd months.static Date
Adds the months.static JKDateTimeUtil.CompareDates
compareTwoDates
(Date date1, Date date2) Compare two dates.static Date
createDate
(int day, int month, int year) Creates the date.static boolean
Equals.static String
Format current date.static String
Format current time stamp.static String
formatDate
(Date date, String pattren) Format date.static String
formatFullTime
(Date date) Format full time.static String
formatTime
(Date date) Format time.static int
Gets the current day in month.static int
Gets the current month.static String
Gets the current time.static String
Gets the current time stamp.static int
Gets the current year.static JKTimeObject
Gets the currnt time.static long
getDayDifference
(Date startDate, Date endDate) Gets the day difference.static int
getDayOfWeek
(Date date) Gets the day of week.static long
getDifference
(Time timeFrom, Time timeTo) Gets the difference.static int
Gets the hour.static long
getHoursDifference
(Date startDate, Date endDate) Gets the hours difference.static long
getMillisDifference
(Date startDate, Date endDate) Gets the millis difference.static long
getMinutesDifference
(Date startDate, Date endDate) Gets the minutes difference.static int
getMonthFromDate
(Date date) Gets the month from date.static int
getNumOfMonths
(Date date1, Date date2) Gets the num of months.static long
getSecondsDifference
(Date startDate, Date endDate) Gets the seconds difference.static Date
Gets the system date.static int
getYearFromData
(Date date) Gets the year from data.static boolean
isCurrentTimeBetweenTowTimes
(Date fromDate, Date fromTime, Date toDate, Date timeTo) Checks if is current time between tow times.static boolean
Checks if is date.static boolean
isDateEqaualed
(Date date1, Date date2) Checks if is date eqaualed.static boolean
isPeriodActive
(Date startDate, Date endDate) Checks if is period active.static boolean
isTimeConflict
(Time timeFrom, Time timeTo, Time otherTimeFrom, Time otherTimeTo) Checks if is time conflict.static boolean
isTimesEqaualed
(Date time1, Date time2) Checks if is times eqaualed.static void
The main method.static Date
Parses the date.static Date
Parses the date.
-
Constructor Details
-
JKDateTimeUtil
public JKDateTimeUtil()
-
-
Method Details
-
parseDate
Parses the date.- Parameters:
strDate
- the str datepattern
- the pattern- Returns:
- the java.util. date
-
formatDate
Format date.- Parameters:
date
- the datepattren
- the pattren- Returns:
- the string
-
formatFullTime
Format full time.- Parameters:
date
- the date- Returns:
- the string
-
getCurrentTime
Gets the current time.- Returns:
- the current time
-
getCurrentTimeStamp
Gets the current time stamp.- Returns:
- the current time stamp
-
getCurrentYear
public static int getCurrentYear()Gets the current year.- Returns:
- the current year
-
getCurrentMonth
public static int getCurrentMonth()Gets the current month.- Returns:
- the current month
-
getYearFromData
Gets the year from data.- Parameters:
date
- the date- Returns:
- the year from data
-
getMonthFromDate
Gets the month from date.- Parameters:
date
- the date- Returns:
- the month from date
-
formatTime
Format time.- Parameters:
date
- the date- Returns:
- the string
-
isTimesEqaualed
Checks if is times eqaualed.- Parameters:
time1
- the time 1time2
- the time 2- Returns:
- true, if is times eqaualed
-
getNumOfMonths
Gets the num of months.- Parameters:
date1
- the date 1date2
- the date 2- Returns:
- the num of months
-
formatCurrentDate
Format current date.- Returns:
- the string
-
formatCurrentTimeStamp
Format current time stamp.- Returns:
- the string
-
compareTwoDates
Compare two dates.- Parameters:
date1
- the date 1date2
- the date 2- Returns:
- the compare dates
-
adddDaysToCurrentDate
Addd days to current date.- Parameters:
numberOfDays
- the number of days- Returns:
- the date
-
isDate
Checks if is date.- Parameters:
strDate
- the str datepattern
- the pattern- Returns:
- true, if is date
-
adddMonths
Addd months.- Parameters:
numOfMonths
- the num of months- Returns:
- the date
-
addMonths
Adds the months.- Parameters:
date
- the datenumOfMonths
- the num of months- Returns:
- the date
-
getDifference
Gets the difference.- Parameters:
timeFrom
- the time fromtimeTo
- the time to- Returns:
- the difference
-
getCurrentDayInMonth
public static int getCurrentDayInMonth()Gets the current day in month.- Returns:
- the current day in month
-
getDayOfWeek
Gets the day of week.- Parameters:
date
- the date- Returns:
- the day of week
-
isTimeConflict
public static boolean isTimeConflict(Time timeFrom, Time timeTo, Time otherTimeFrom, Time otherTimeTo) Checks if is time conflict.- Parameters:
timeFrom
- the time fromtimeTo
- the time tootherTimeFrom
- the other time fromotherTimeTo
- the other time to- Returns:
- true, if is time conflict
-
getHour
Gets the hour.- Parameters:
timeFrom
- the time from- Returns:
- the hour
-
equals
Equals.- Parameters:
date1
- the date 1date2
- the date 2- Returns:
- true, if successful
-
isCurrentTimeBetweenTowTimes
public static boolean isCurrentTimeBetweenTowTimes(Date fromDate, Date fromTime, Date toDate, Date timeTo) Checks if is current time between tow times.- Parameters:
fromDate
- the from datefromTime
- the from timetoDate
- the to datetimeTo
- the time to- Returns:
- true, if is current time between tow times
-
getCurrntTime
Gets the currnt time.- Returns:
- the currnt time
-
getDayDifference
Gets the day difference.- Parameters:
startDate
- the start dateendDate
- the end date- Returns:
- the day difference
-
getSecondsDifference
Gets the seconds difference.- Parameters:
startDate
- the start dateendDate
- the end date- Returns:
- the seconds difference
-
getHoursDifference
Gets the hours difference.- Parameters:
startDate
- the start dateendDate
- the end date- Returns:
- the hours difference
-
getMillisDifference
Gets the millis difference.- Parameters:
startDate
- the start dateendDate
- the end date- Returns:
- the millis difference
-
getMinutesDifference
Gets the minutes difference.- Parameters:
startDate
- the start dateendDate
- the end date- Returns:
- the minutes difference
-
main
The main method.- Parameters:
args
- the arguments
-
isDateEqaualed
Checks if is date eqaualed.- Parameters:
date1
- the date 1date2
- the date 2- Returns:
- true, if is date eqaualed
-
isPeriodActive
Checks if is period active.- Parameters:
startDate
- the start dateendDate
- the end date- Returns:
- true, if is period active
-
getSystemDate
Gets the system date.- Returns:
- the system date
-
parseDate
Parses the date.- Parameters:
date
- the date- Returns:
- the date
-
createDate
Creates the date.- Parameters:
day
- the daymonth
- the monthyear
- the year- Returns:
- the date
-