Class JKDateTimeUtil

java.lang.Object
com.jk.core.util.JKDateTimeUtil

public class JKDateTimeUtil extends Object
The Class JKDateTimeUtil.
  • Constructor Details

    • JKDateTimeUtil

      public JKDateTimeUtil()
  • Method Details

    • parseDate

      public static Date parseDate(String strDate, String pattern)
      Parses the date.
      Parameters:
      strDate - the str date
      pattern - the pattern
      Returns:
      the java.util. date
    • formatDate

      public static String formatDate(Date date, String pattren)
      Format date.
      Parameters:
      date - the date
      pattren - the pattren
      Returns:
      the string
    • formatFullTime

      public static String formatFullTime(Date date)
      Format full time.
      Parameters:
      date - the date
      Returns:
      the string
    • getCurrentTime

      public static String getCurrentTime()
      Gets the current time.
      Returns:
      the current time
    • getCurrentTimeStamp

      public static String 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

      public static int getYearFromData(Date date)
      Gets the year from data.
      Parameters:
      date - the date
      Returns:
      the year from data
    • getMonthFromDate

      public static int getMonthFromDate(Date date)
      Gets the month from date.
      Parameters:
      date - the date
      Returns:
      the month from date
    • formatTime

      public static String formatTime(Date date)
      Format time.
      Parameters:
      date - the date
      Returns:
      the string
    • isTimesEqaualed

      public static boolean isTimesEqaualed(Date time1, Date time2)
      Checks if is times eqaualed.
      Parameters:
      time1 - the time 1
      time2 - the time 2
      Returns:
      true, if is times eqaualed
    • getNumOfMonths

      public static int getNumOfMonths(Date date1, Date date2)
      Gets the num of months.
      Parameters:
      date1 - the date 1
      date2 - the date 2
      Returns:
      the num of months
    • formatCurrentDate

      public static String formatCurrentDate()
      Format current date.
      Returns:
      the string
    • formatCurrentTimeStamp

      public static String formatCurrentTimeStamp()
      Format current time stamp.
      Returns:
      the string
    • compareTwoDates

      public static JKDateTimeUtil.CompareDates compareTwoDates(Date date1, Date date2)
      Compare two dates.
      Parameters:
      date1 - the date 1
      date2 - the date 2
      Returns:
      the compare dates
    • adddDaysToCurrentDate

      public static Date adddDaysToCurrentDate(int numberOfDays)
      Addd days to current date.
      Parameters:
      numberOfDays - the number of days
      Returns:
      the date
    • isDate

      public static boolean isDate(String strDate, String pattern)
      Checks if is date.
      Parameters:
      strDate - the str date
      pattern - the pattern
      Returns:
      true, if is date
    • adddMonths

      public static Date adddMonths(int numOfMonths)
      Addd months.
      Parameters:
      numOfMonths - the num of months
      Returns:
      the date
    • addMonths

      public static Date addMonths(Date date, int numOfMonths)
      Adds the months.
      Parameters:
      date - the date
      numOfMonths - the num of months
      Returns:
      the date
    • getDifference

      public static long getDifference(Time timeFrom, Time timeTo)
      Gets the difference.
      Parameters:
      timeFrom - the time from
      timeTo - the time to
      Returns:
      the difference
    • getCurrentDayInMonth

      public static int getCurrentDayInMonth()
      Gets the current day in month.
      Returns:
      the current day in month
    • getDayOfWeek

      public static int getDayOfWeek(Date date)
      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 from
      timeTo - the time to
      otherTimeFrom - the other time from
      otherTimeTo - the other time to
      Returns:
      true, if is time conflict
    • getHour

      public static int getHour(Date timeFrom)
      Gets the hour.
      Parameters:
      timeFrom - the time from
      Returns:
      the hour
    • equals

      public static boolean equals(Date date1, Date date2)
      Equals.
      Parameters:
      date1 - the date 1
      date2 - 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 date
      fromTime - the from time
      toDate - the to date
      timeTo - the time to
      Returns:
      true, if is current time between tow times
    • getCurrntTime

      public static JKTimeObject getCurrntTime()
      Gets the currnt time.
      Returns:
      the currnt time
    • getDayDifference

      public static long getDayDifference(Date startDate, Date endDate)
      Gets the day difference.
      Parameters:
      startDate - the start date
      endDate - the end date
      Returns:
      the day difference
    • getSecondsDifference

      public static long getSecondsDifference(Date startDate, Date endDate)
      Gets the seconds difference.
      Parameters:
      startDate - the start date
      endDate - the end date
      Returns:
      the seconds difference
    • getHoursDifference

      public static long getHoursDifference(Date startDate, Date endDate)
      Gets the hours difference.
      Parameters:
      startDate - the start date
      endDate - the end date
      Returns:
      the hours difference
    • getMillisDifference

      public static long getMillisDifference(Date startDate, Date endDate)
      Gets the millis difference.
      Parameters:
      startDate - the start date
      endDate - the end date
      Returns:
      the millis difference
    • getMinutesDifference

      public static long getMinutesDifference(Date startDate, Date endDate)
      Gets the minutes difference.
      Parameters:
      startDate - the start date
      endDate - the end date
      Returns:
      the minutes difference
    • main

      public static void main(String[] args)
      The main method.
      Parameters:
      args - the arguments
    • isDateEqaualed

      public static boolean isDateEqaualed(Date date1, Date date2)
      Checks if is date eqaualed.
      Parameters:
      date1 - the date 1
      date2 - the date 2
      Returns:
      true, if is date eqaualed
    • isPeriodActive

      public static boolean isPeriodActive(Date startDate, Date endDate)
      Checks if is period active.
      Parameters:
      startDate - the start date
      endDate - the end date
      Returns:
      true, if is period active
    • getSystemDate

      public static Date getSystemDate()
      Gets the system date.
      Returns:
      the system date
    • parseDate

      public static Date parseDate(String date)
      Parses the date.
      Parameters:
      date - the date
      Returns:
      the date
    • createDate

      public static Date createDate(int day, int month, int year)
      Creates the date.
      Parameters:
      day - the day
      month - the month
      year - the year
      Returns:
      the date