by Anonymous » 24 Feb 2025, 12:18
Ich mache einen Datumstest < /p>
Code: Select all
String INCORRECT_DATE_1 = "101.10.2010";
String dtFormatString_104 = "dd.MM.yyyy";
@Test
public void isValidDate() {
FastDateFormat formatter = FastDateFormat.getInstance(dtFormatString_104);
try {
final Date parse = formatter.parse(INCORRECT_DATE_1);
} catch (java.text.ParseException e) {
return false;
}
return true;
}
und ich werden hier wahr, weil Parse 9. Januar 2011 ist. Wie kann ich es richtig validieren?
Ich möchte hier aufgrund des Inkorrekturdatums
Ich mache einen Datumstest < /p>
[code] String INCORRECT_DATE_1 = "101.10.2010";
String dtFormatString_104 = "dd.MM.yyyy";
@Test
public void isValidDate() {
FastDateFormat formatter = FastDateFormat.getInstance(dtFormatString_104);
try {
final Date parse = formatter.parse(INCORRECT_DATE_1);
} catch (java.text.ParseException e) {
return false;
}
return true;
}
[/code]
und ich werden hier wahr, weil Parse 9. Januar 2011 ist. Wie kann ich es richtig validieren? [url=viewtopic.php?t=14917]Ich möchte[/url] hier aufgrund des Inkorrekturdatums