Class TimeConvert

java.lang.Object
org.bgerp.util.TimeConvert

public class TimeConvert extends Object
Date ant time converting utils.
  • Constructor Details

    • TimeConvert

      public TimeConvert()
  • Method Details

    • toYearMonth

      public static final YearMonth toYearMonth(Date value)
      Converts date to month of year.
      Parameters:
      value -
      Returns:
      null or month, containing value.
    • toDate

      public static final Date toDate(YearMonth value)
      Converts the first day of a month to date.
      Parameters:
      value - the month.
      Returns:
      null or date of the first day of the month value.
    • toDate

      public static final Date toDate(LocalDate value)
      Converts beginning of a day to date.
      Parameters:
      value - the day.
      Returns:
      null or date of the beginning of the day value.
    • toLocalDate

      public static final LocalDate toLocalDate(Date value)
      Converts date to local date.
      Parameters:
      value -
      Returns:
      null or converted value.
    • toTimestamp

      public static final Timestamp toTimestamp(Date value)
      Converts date to SQL timestamp.
      Parameters:
      value -
      Returns:
      null or converted value.
    • toInstant

      public static final Instant toInstant(LocalDateTime value)
      Converts date and time to instant.
      Parameters:
      value -
      Returns:
      null or converted value.
    • toDuration

      public static Duration toDuration(LocalTime value)
      Converts a local time to duration between 0 and the time
      Parameters:
      value -
      Returns:
    • toLocalTime

      public static LocalTime toLocalTime(Duration duration)
      Converts a duration to time after adding the duration to 0
      Parameters:
      duration -
      Returns: