public static Date pgnDateHeaderToDate(String pgnDateValue){
  Date result=null;
  initPgnDateHeader();
  if (pgnDateValue.length() != 10) {
    LOG.error("Invalid pgn header date format: " + pgnDateValue + " setting to default.");
    result=DEFAULT_PGN_DATE_HEADER;
  }
 else   if (pgnDateValue.startsWith("????")) {
    result=DEFAULT_PGN_DATE_HEADER;
  }
 else {
    String year=pgnDateValue.substring(0,4);
    String month=pgnDateValue.substring(5,7);
    String day=pgnDateValue.substring(8,10);
    if (month.equals("??")) {
      month="01";
    }
    if (day.equals("??")) {
      day="01";
    }
    try {
      result=PGN_HEADER_DATE_FORMAT.parse(year + "." + month+ "."+ day);
    }
 catch (    ParseException pe) {
      LOG.error("Invalid pgn header date format: " + pgnDateValue + " "+ year+ "."+ month+ "."+ day+ " setting to default.");
      result=DEFAULT_PGN_DATE_HEADER;
    }
  }
  return result;
}

public static Date pgnDateHeaderToDate ( String pgnDateValue ) { Date result = null ; initPgnDateHeader ( ) ; if ( pgnDateValue . length ( ) != 10 ) { LOG . error ( "Invalid pgn header date format: " + pgnDateValue + " setting to default." ) ; result = DEFAULT_PGN_DATE_HEADER ; } else if ( pgnDateValue . startsWith ( "????" ) ) { result = DEFAULT_PGN_DATE_HEADER ; } else { String year = pgnDateValue . substring ( 0 , 4 ) ; String month = pgnDateValue . substring ( 5 , 7 ) ; String day = pgnDateValue . substring ( 8 , 10 ) ; if ( month . equals ( "??" ) ) { month = "01" ; } if ( day . equals ( "??" ) ) { day = "01" ; } try { result = PGN_HEADER_DATE_FORMAT . parse ( year + "." + month + "." + day ) ; } catch ( ParseException pe ) { LOG . error ( "Invalid pgn header date format: " + pgnDateValue + " " + year + "." + month + "." + day + " setting to default." ) ; result = DEFAULT_PGN_DATE_HEADER ; } } return result ; }
converts a pgnheader . date header into a date object .
