Class DateUtils


  • public class DateUtils
    extends Object
    Common methods for working with dates.
    Since:
    2.5.0
    Author:
    oswaldo.bapvic.jr (Oswaldo Junior)
    • Method Detail

      • parseDateRfc3339

        public static Date parseDateRfc3339​(String string)
        Parses the given date-time representation string based in RFC-3339 format, producing a Date.

        Either of the following examples are acceptable:

        • "2019-09-07T13:21:59Z"
        • "2020-10-08 13:22:58.654Z"
        • "2021-11-09T10:23:57.321+00:00"
        • "2022-12-10 10:24:56.987654321-03:00"
        Parameters:
        string - the string to parse; not null
        Returns:
        the parsed Date; not null
      • parseInstantRfc3339

        public static Instant parseInstantRfc3339​(String string)
        Parses the given date-time representation string based in RFC-3339 format, producing an Instant.

        Either of the following examples are acceptable:

        • "2019-09-07T13:21:59.987Z"
        • "2020-10-08 13:22:58.654Z"
        • "2021-11-09T10:23:57.321+00:00"
        • "2022-12-10 10:24:56.987654321-03:00"
        Parameters:
        string - the string to parse; not null
        Returns:
        the parsed Instant; not null