fecha fuera de rango
Publicado por hugo (14 intervenciones) el 03/05/2006 12:12:28
Hola:
Me podrían ayudar a determinar cuando una fecha esta fuera de calendario.
Estoy usando textField, que tien el siguiente Fomato:
JFormattedTextField textField = new JFormattedTextField(new FormatoFecha());
textField.setValue(new Date());
La Clase FormatoFecha:
class FormatoFecha extends MaskFormatter
{
public FormatoFecha() throws ParseException
{
super ("##/##/##");
}
private SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yy");
public Object stringToValue(String text) throws ParseException
{
return formato.parseObject(text);
}
public String valueToString(Object value) throws ParseException
{
if (value instanceof Date)
return formato.format((Date)value);
return formato.format(new Date());
}
}
Saludos y Muchas gracias.
Me podrían ayudar a determinar cuando una fecha esta fuera de calendario.
Estoy usando textField, que tien el siguiente Fomato:
JFormattedTextField textField = new JFormattedTextField(new FormatoFecha());
textField.setValue(new Date());
La Clase FormatoFecha:
class FormatoFecha extends MaskFormatter
{
public FormatoFecha() throws ParseException
{
super ("##/##/##");
}
private SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yy");
public Object stringToValue(String text) throws ParseException
{
return formato.parseObject(text);
}
public String valueToString(Object value) throws ParseException
{
if (value instanceof Date)
return formato.format((Date)value);
return formato.format(new Date());
}
}
Saludos y Muchas gracias.
Valora esta pregunta


0