be.ehealth.technicalconnector.utils

## Class DateUtils

- java.lang.Object
- - be.ehealth.technicalconnector.utils.DateUtils

-     public final class DateUtils
      extends Object

  Utility class to work with dates

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static org.joda.time.DateTime` | `convert(Calendar cal)` Converts an java.util.Calendar to an org.joda.DateTime
    `static org.joda.time.DateTime` | `convert(Date date)` Converts an java.util.Date to an org.joda.DateTime
    `static org.joda.time.DateTime` | `parseDate(String lexicalXSDDate)` Parses a date from the given lexicalXSDDate, returning a new DateTime.
    `static org.joda.time.DateTime` | `parseDateTime(String lexicalXSDDate)` Parses a datetime from the given lexicalXSDDate, returning a new DateTime.
    `static org.joda.time.DateTime` | `parseTime(String lexicalXSDDate)` Parses a time from the given lexicalXSDDate, returning a new DateTime.
    `static String` | `printDate(org.joda.time.DateTime dateTime)` Parses the dateTime, returning a string.
    `static String` | `printDateTime(org.joda.time.DateTime dateTime)` Combines the date and time by using the following format: yyyy-MM-dd'T'HH:mm:ss.SSSZZ
    `static String` | `printDateWithoutTimeZone(org.joda.time.DateTime dateTime)` Parses the dateTime, returning a string without timezone.
    `static String` | `printTime(org.joda.time.DateTime dateTime)` Gives the time by using the following format: HH:mm:ss.SSSZZ
    `static String` | `printTimeWithoutTimezone(org.joda.time.DateTime dateTime)` Gives the time by using the following format: HH:mm:ss.SSSZZ

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

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

- - ### Method Detail

    - #### parseDateTime

          public static org.joda.time.DateTime parseDateTime(String lexicalXSDDate)

      Parses a datetime from the given lexicalXSDDate, returning a new DateTime. (ISO8601 standard)

      The parse will use the zone and chronology specified on this formatter.

      If the lexicalXSDDate contains a time zone string then that will be taken into account in adjusting the time of day as follows. The the resulting DateTime will have the zone of this formatter, but the parsed zone may have caused the time to be adjusted.

           datetime          = time | date-opt-time
           time              = 'T' time-element [offset]
           date-opt-time     = date-element ['T' [time-element] [offset]]
           date-element      = std-date-element | ord-date-element | week-date-element
           std-date-element  = yyyy ['-' MM ['-' dd]]
           ord-date-element  = yyyy ['-' DDD]
           week-date-element = xxxx '-W' ww ['-' e]
           time-element      = HH [minute-element] | [fraction]
           minute-element    = ':' mm [second-element] | [fraction]
           second-element    = ':' ss [fraction]
           fraction          = ('.' | ',') digit+
           offset            = 'Z' | (('+' | '-') HH [':' mm [':' ss [('.' | ',') SSS]]])

      for example: 2012-10-15T05:38:14.030+02:00

      Parameters:
        `lexicalXSDDate` -
      Returns:
        the new DateTime

    - #### printDateTime

          public static String printDateTime(org.joda.time.DateTime dateTime)

      Combines the date and time by using the following format: yyyy-MM-dd'T'HH:mm:ss.SSSZZ
      Parameters:
        `dateTime` -
      Returns:
        the string value

    - #### parseTime

          public static org.joda.time.DateTime parseTime(String lexicalXSDDate)

      Parses a time from the given lexicalXSDDate, returning a new DateTime. (ISO8601 standard)

      The parse will use the zone and chronology specified on this formatter.

      If the lexicalXSDDate contains a time zone string then that will be taken into account in adjusting the time of day as follows. The the resulting DateTime will have the zone of this formatter, but the parsed zone may have caused the time to be adjusted.

           time           = ['T'] time-element [offset]
           time-element   = HH [minute-element] | [fraction]
           minute-element = ':' mm [second-element] | [fraction]
           second-element = ':' ss [fraction]
           fraction       = ('.' | ',') digit+
           offset         = 'Z' | (('+' | '-') HH [':' mm [':' ss [('.' | ',') SSS]]])

      Parameters:
        `lexicalXSDDate` -
      Returns:
        the new DateTime

    - #### printTime

          public static String printTime(org.joda.time.DateTime dateTime)

      Gives the time by using the following format: HH:mm:ss.SSSZZ
      Parameters:
        `dateTime` -
      Returns:
        the string value

    - #### printTimeWithoutTimezone

          public static String printTimeWithoutTimezone(org.joda.time.DateTime dateTime)

      Gives the time by using the following format: HH:mm:ss.SSSZZ
      Parameters:
        `dateTime` -
      Returns:
        the string value

    - #### parseDate

          public static org.joda.time.DateTime parseDate(String lexicalXSDDate)

      Parses a date from the given lexicalXSDDate, returning a new DateTime. (ISO8601 standard)

      The parse will use the zone and chronology specified on this formatter.

      If the lexicalXSDDate contains a time zone string then that will be taken into account in adjusting the time of day as follows. The the resulting DateTime will have the zone of this formatter, but the parsed zone may have caused the time to be adjusted.

      Parameters:
        `lexicalXSDDate` -
      Returns:
        the new DateTime

    - #### printDate

          public static String printDate(org.joda.time.DateTime dateTime)

      Parses the dateTime, returning a string. (ISO8601 standard)

      The parse will use the zone and chronology specified on this formatter.

      Parameters:
        `dateTime` -
      Returns:
        the string value

    - #### printDateWithoutTimeZone

          public static String printDateWithoutTimeZone(org.joda.time.DateTime dateTime)

      Parses the dateTime, returning a string without timezone. (ISO8601 standard)

      The resulting format is yyyy-MM-dd

      Parameters:
        `dateTime` -
      Returns:
        the string value

    - #### convert

          public static org.joda.time.DateTime convert(Calendar cal)

      Converts an java.util.Calendar to an org.joda.DateTime
      Parameters:
        `cal` -
      Returns:
        the new DateTime

    - #### convert

          public static org.joda.time.DateTime convert(Date date)

      Converts an java.util.Date to an org.joda.DateTime
      Parameters:
        `date` - the date
      Returns:
        the DateTime

Connector Packaging TECHNICAL 4.4.0 API
Copyright © {inceptionYear}-2023 eHealth. All Rights Reserved.