commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lance Semmens <>
Subject RE: TimeStamp validator
Date Wed, 27 Apr 2005 23:38:05 GMT
Your date pattern is "dd/MM/yyyy hh:mm:ss"
If you are expecting 24 hour time, you should use HH instead of hh.

-----Original Message-----
From: Rodolfo García Esteban/CYII []
Sent: Wednesday, 27 April 2005 6:19 PM
To: Jakarta Commons Users List
Subject: Re: TimeStamp validator
Importance: Low

Hola Jose Antonio.

This is the code.

                if (entradaString != null && !entradaString.equals("")) {
                        bEntradaEnter = true;
                        log.trace("La fecha es ||" + entradaString + 
                        if (GenericValidator.isDate(entradaString, 
"dd/MM/yyyy hh:mm:ss", false)) {
                                try {
                                        entrada = 
                                catch (ParseException pe) {
                                        errors.add("entradaString", new 
ActionMessage("errors.formato.fecha", "Entrada"));
                                        log.error("Error al convertir 
fecha Entrada " + entradaString);
                        else {
                                errors.add("entradaString", new 
ActionMessage("errors.formato.fecha", "Entrada")); 
                                log.trace("Entrada no es una fecha 
correcta. dd/MM/yyyy " + entradaString);

I have rewrite the pattern and works well. Thank you,

Gracias saludos


José Antonio Pérez Testa <>
27/04/2005 10:16
Por favor, responda a "Jakarta Commons Users List"

        Para:   Jakarta Commons Users List <>
        cc:     (cco: Rodolfo García Esteban/CYII)
        Asunto: Re: TimeStamp validator

Hola Rodolfo,
The javadoc for isDate states that the pattern is used with 
Maybe your pattern is not correct for the validation your need.
Can you give us the pattern and the String to validate.

public static boolean *isDate*(java.lang.String value,
                             java.lang.String datePattern,
                             boolean strict)

Checks if the field is a valid date. The pattern is used with 

|Rodolfo García Esteban/CYII wrote:

>I use GenericValidator.isDate(), when I try to 
>validate with the pattern "dd/MM/yyyy" works well, but when I use the 
>pattern "dd/MM/yyyy hh:mm:ss", doesn't work well, it returns false when 
>checks a valid string. How  I can validate this pattern date?. Is there 
>any timeStampValidator or something like that?
>Thanks in advance,


José Antonio Pérez Testa
Ingeniería de Servicios e Innovación técnologica.

Telémaco 3
28027 - Madrid (ESPAÑA)
Tel: +34-91-480.81.12

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message