Java Regex Date Vaidate dateTimeMatcher(String dt)

Here you can find the source of dateTimeMatcher(String dt)

Description

date Time Matcher

License

Apache License

Declaration

public static boolean dateTimeMatcher(String dt) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static boolean dateTimeMatcher(String dt) {
        Pattern pattern = Pattern.compile(
                "^(((20[0-3][0-9]-(0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|(20[0-3][0-9]-(0[2469]|11)-(0[1-9]|[12][0-9]|30))) (20|21|22|23|[0-1][0-9]):[0-5][0-9]:[0-5][0-9])$");
        Matcher matcher = pattern.matcher(dt);
        return matcher.matches();
    }/*from  w ww  . ja va2  s .  c o m*/
}

Related

  1. checkDate(String strDate, String dateFmt)
  2. checkDateYYYYMMMDD(String date)
  3. dateMatcher(String dt)
  4. dateOfAny(final String value)
  5. datePatternPattern(String appenderPrefix)
  6. dateTimePattern()
  7. dateToString(Date date)
  8. parseDate(final String date, final DateTimeFormatter parser)
  9. parseDate(String date)