Class ConstDateTime

java.lang.Object
me.saro.kit.dates.ConstDateTime

public class ConstDateTime
extends java.lang.Object
const date time
this class thread-safe because all compute use clone
Since:
1.0.0
Author:
PARK Yong Seo
  • Method Details

    • now

      public static ConstDateTime now()
      new instant DateFormat with Calendar.getInstance()
      Returns:
    • parse

      public static ConstDateTime parse​(long timeInMillis)
      timeInMillis to DateFormat
      Parameters:
      timeInMillis -
      Returns:
    • parse

      public static ConstDateTime parse​(java.lang.String date, java.lang.String format)
      String date to DateFormat
      Parameters:
      date -
      format -
      Returns:
    • format

      public static java.lang.String format​(java.lang.String date, java.lang.String oldFormat, java.lang.String newFormat)
      convert string date format
      Parameters:
      date -
      oldFormat -
      newFormat -
      Returns:
    • valid

      public static boolean valid​(java.lang.String date, java.lang.String format)
      date validator
      Parameters:
      date -
      format -
      Returns:
    • timezone

      public ConstDateTime timezone​(java.util.TimeZone timeZone)
    • plusMilliseconds

      public ConstDateTime plusMilliseconds​(int milliseconds)
      return plus milliseconds
      Parameters:
      milliseconds -
      Returns:
    • plusMinutes

      public ConstDateTime plusMinutes​(int minutes)
      return plus minutes
      Parameters:
      minutes -
      Returns:
    • plusHours

      public ConstDateTime plusHours​(int hours)
      return plus hours
      Parameters:
      hours -
      Returns:
    • plusDates

      public ConstDateTime plusDates​(int date)
      return plus dates
      Parameters:
      date -
      Returns:
    • plusMonths

      public ConstDateTime plusMonths​(int month)
      return plus month
      Parameters:
      month -
      Returns:
    • plusYears

      public ConstDateTime plusYears​(int year)
      return plus year
      Parameters:
      year -
      Returns:
    • withTimeInMillis

      public ConstDateTime withTimeInMillis​(long timeInMillis)
      WARNING : is not Milliseconds
      return with timeInMillis
      Parameters:
      timeInMillis -
      Returns:
    • withMilliseconds

      public ConstDateTime withMilliseconds​(int milliseconds)
      WARNING : is not TimeInMillis
      return with milliseconds
      Parameters:
      milliseconds -
      Returns:
    • withSeconds

      public ConstDateTime withSeconds​(int seconds)
      return with seconds
      Parameters:
      seconds -
      Returns:
    • withMinutes

      public ConstDateTime withMinutes​(int minutes)
      return with minutes
      Parameters:
      minutes -
      Returns:
    • withHours

      public ConstDateTime withHours​(int hours)
      return with hours
      Parameters:
      hours -
      Returns:
    • withDayOfMonth

      public ConstDateTime withDayOfMonth​(int day)
      return with dayOfMonth
      Parameters:
      day -
      Returns:
    • withMonth

      public ConstDateTime withMonth​(int month)
      return with month
      Parameters:
      month -
      Returns:
    • withYear

      public ConstDateTime withYear​(int year)
      return with year
      Parameters:
      year -
      Returns:
    • getTimeInMillis

      public long getTimeInMillis()
      get TimeInMillis
      WARNING : is not Milliseconds
      Returns:
    • getMilliseconds

      public int getMilliseconds()
      get Milliseconds
      WARNING : is not TimeInMillis
      Returns:
    • getSeconds

      public int getSeconds()
      get Seconds
      Returns:
    • getMinute

      public int getMinute()
      get Minute
      Returns:
    • getHours

      public int getHours()
      get Hours
      Returns:
    • getDate

      public int getDate()
      get Date
      Returns:
    • getMonth

      public int getMonth()
      get Month
      Returns:
    • getYear

      public int getYear()
      get Year
      Returns:
    • getDayOfWeek

      public int getDayOfWeek()
      get DayOfWeek
      Returns:
    • getDayOfIntWeek

      public int getDayOfIntWeek()
      get DayOfIntWeek 0:sun - 1:mon ... 6:sat
      Returns:
    • getWeekOfMonth

      public int getWeekOfMonth()
      get WeekOfMonth
      Returns:
    • getWeekOfYear

      public int getWeekOfYear()
      get WeekOfYear
      Returns:
    • getLastDayOfMonth

      public int getLastDayOfMonth()
      Last Day Of Month
      Returns:
    • diffYears

      public int diffYears​(ConstDateTime constDateTime)
      diff year
      Parameters:
      constDateTime -
      Returns:
    • diffMonths

      public int diffMonths​(ConstDateTime constDateTime)
      diff month
      Parameters:
      constDateTime -
      Returns:
    • diffDays

      public int diffDays​(ConstDateTime constDateTime)
      diff day
      Parameters:
      constDateTime -
      Returns:
    • remainDaysUntilLastDayOfMonth

      public int remainDaysUntilLastDayOfMonth()
      Days remaining until last day of month
      ex) 2019-12-30 -> 1
      ex) 2019-12-31 -> 0
      Returns:
    • format

      public java.lang.String format​(java.lang.String format)
      DateFormat to String
      Parameters:
      format -
      Returns:
    • toString

      public java.lang.String toString​(java.lang.String format)
      DateFormat to String
      same format(String format)
      Parameters:
      format -
      Returns:
    • toString

      public java.lang.String toString()
      to ISO8601 yyyy-MM-dd'T'HH:mm:ssZ[+HH:mm]
      Overrides:
      toString in class java.lang.Object
    • toISO8601

      public java.lang.String toISO8601()
      to ISO8601
      Returns:
    • onlyDate

      public ConstDateTime onlyDate()
      remove hh MM ss
    • equalsYear

      public boolean equalsYear​(ConstDateTime constDateTime)
      Parameters:
      constDateTime -
      Returns:
    • equalsYearMonth

      public boolean equalsYearMonth​(ConstDateTime constDateTime)
      Parameters:
      constDateTime -
      Returns:
    • equalsYearMonthDate

      public boolean equalsYearMonthDate​(ConstDateTime constDateTime)
      Parameters:
      constDateTime -
      Returns:
    • toDate

      public java.util.Date toDate()
      to Date
      Returns:
    • clone

      public ConstDateTime clone()
      clone
      Overrides:
      clone in class java.lang.Object
    • toCalendar

      public java.util.Calendar toCalendar()
      toCalendar
    • equals

      public boolean equals​(java.lang.Object obj)
      equals
      Overrides:
      equals in class java.lang.Object