Class SchedulerTimeUtils


  • public class SchedulerTimeUtils
    extends Object
    Provides utility methods that help to deal with dates when scheduling a process.
    • Method Detail

      • timestamp

        public static Date timestamp​(String dateTime)
                              throws ParseException
        Utility method to parse a date with time String into a Date.
        Parameters:
        dateTime - A date with time as a String. Expected format: 'dd-MM-yyyy HH:mm:ss'
        Returns:
        a Date with the provided date and time.
        Throws:
        ParseException - if the provided date and time can not be parsed to create the Date instance.
      • currentDate

        public static String currentDate​(String format)
        Formats the current date using a specific format.
        Parameters:
        format - the date time format to be applied.
        Returns:
        a String with the current date time formatted with the provided format.
      • format

        public static String format​(Date date,
                                    String format)
        Formats the provided date using a specific format.
        Parameters:
        format - the date time format to be applied.
        Returns:
        a String with the date formatted with the provided format.