Falsches DateFormat isvalidJava

Java-Forum
Anonymous
 Falsches DateFormat isvalid

Post by Anonymous »

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

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post
  • Wie konvertiere ich String in Java in DateFormat?
    by Anonymous » » in Java
    0 Replies
    2 Views
    Last post by Anonymous
  • ModelState.isvalid Auch wenn es nicht sein sollte?
    by Anonymous » » in C#
    0 Replies
    7 Views
    Last post by Anonymous
  • Gradle findet falsches JAVA_HOME, obwohl es richtig eingestellt ist
    by Guest » » in Java
    0 Replies
    24 Views
    Last post by Guest
  • Java lwjgl mit ImGui zeigt falsches Bild
    by Anonymous » » in Java
    0 Replies
    32 Views
    Last post by Anonymous
  • Falsches Drucken von Akzenten (Zebra ZD420, ZPL)
    by Guest » » in C#
    0 Replies
    19 Views
    Last post by Guest