Package org.bgerp.util

# Class TimeConvert

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

public class TimeConvert extends Object
Date ant time converting utils.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TimeConvert()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static final Date`
  `toDate(LocalDate value)`
  Converts beginning of a day to date.
  `static final Date`
  `toDate(YearMonth value)`
  Converts the first day of a month to date.
  `static Duration`
  `toDuration(LocalTime value)`
  Converts a local time to duration between 0 and the time
  `static final Instant`
  `toInstant(LocalDateTime value)`
  Converts date and time to instant.
  `static final LocalDate`
  `toLocalDate(Date value)`
  Converts date to local date.
  `static LocalTime`
  `toLocalTime(Duration duration)`
  Converts a duration to time after adding the duration to 0
  `static final Timestamp`
  `toTimestamp(Date value)`
  Converts date to SQL timestamp.
  `static final YearMonth`
  `toYearMonth(Date value)`
  Converts date to month of year.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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: