public static java . util . Date toDate ( String date , String time ) { if ( date == null || time == null ) return null ; String month ; String day ; String year ; String hour ; String minute ; String second ; int dateSlash1 = date . indexOf ( "/" ) ; int dateSlash2 = date . lastIndexOf ( "/" ) ; if ( dateSlash1 <= 0 || dateSlash1 == dateSlash2 ) return null ; int timeColon1 = time . indexOf ( ":" ) ; int timeColon2 = time . lastIndexOf ( ":" ) ; if ( timeColon1 <= 0 ) return null ; month = date . substring ( 0 , dateSlash1 ) ; day = date . substring ( dateSlash1 + 1 , dateSlash2 ) ; year = date . substring ( dateSlash2 + 1 ) ; hour = time . substring ( 0 , timeColon1 ) ; if ( timeColon1 == timeColon2 ) { minute = time . substring ( timeColon1 + 1 ) ; second = "0" ; } else { minute = time . substring ( timeColon1 + 1 , timeColon2 ) ; second = time . substring ( timeColon2 + 1 ) ; } return toDate ( month , day , year , hour , minute , second ) ; }
Converts a date String and a time String into a Date