Class PatternDateConverter

    • Constructor Detail

      • PatternDateConverter

        public PatternDateConverter​(String datePattern,
                                    boolean applyTimeZoneDifference)
        Construct.

        When applyTimeZoneDifference is true, the current time is applied on the parsed date, and the date will be corrected for the time zone difference between the server and the client. For instance, if I'm in Seattle and the server I'm working on is in Amsterdam, the server is 9 hours ahead. So, if I'm inputting say 12/24 at a couple of hours before midnight, at the server it is already 12/25. If this boolean is true, it will be transformed to 12/25, while the client sees 12/24.

        Parameters:
        datePattern - The pattern to use. Must be not null. See SimpleDateFormat for available patterns.
        applyTimeZoneDifference - whether to apply the difference in time zones between client and server
        Throws:
        IllegalArgumentException - in case the date pattern is null
    • Method Detail

      • getDatePattern

        public final String getDatePattern​(Locale locale)
        Gets the optional date pattern.
        Specified by:
        getDatePattern in class DateConverter
        Parameters:
        locale - The locale used to convert the value
        Returns:
        datePattern
      • getFormat

        protected org.joda.time.format.DateTimeFormatter getFormat​(Locale locale)
        Specified by:
        getFormat in class DateConverter
        Parameters:
        locale - The locale used to convert the value
        Returns:
        formatter The formatter for the current conversion