public List < DateTime > getDateList ( final List < StringValue > _date , final List < StringValue > _hour , final List < StringValue > _minute , final List < StringValue > _ampm ) throws EFapsException { final List < DateTime > ret = new ArrayList <> ( ) ; if ( _date != null ) { Iterator < StringValue > hourIter = null ; Iterator < StringValue > minuteIter = null ; Iterator < StringValue > ampmIter = null ; if ( _hour != null ) { hourIter = _hour . iterator ( ) ; } if ( _minute != null ) { minuteIter = _minute . iterator ( ) ; } if ( _ampm != null ) { ampmIter = _ampm . iterator ( ) ; } for ( final StringValue date : _date ) { if ( ! date . isNull ( ) && ! date . isEmpty ( ) ) { final DateTimeFormatter fmt = DateTimeFormat . forPattern ( this . converter . getDatePattern ( Context . getThreadContext ( ) . getLocale ( ) ) ) . withChronology ( Context . getThreadContext ( ) . getChronology ( ) ) ; fmt . withLocale ( getLocale ( ) ) ; final MutableDateTime mdt = fmt . parseMutableDateTime ( date . toString ( ) ) ; if ( hourIter != null ) { final StringValue hourStr = hourIter . next ( ) ; final int hour = Integer . parseInt ( hourStr . toString ( "0" ) ) ; mdt . setHourOfDay ( hour ) ; if ( ampmIter != null ) { final StringValue ampmStr = ampmIter . next ( ) ; if ( "am" . equals ( ampmStr . toString ( "am" ) ) ) { if ( hour == 12 ) { mdt . setHourOfDay ( 0 ) ; } } else { if ( hour != 12 ) { mdt . setHourOfDay ( hour + 12 ) ; } } } if ( minuteIter != null ) { final StringValue minuteStr = minuteIter . next ( ) ; final int minute = Integer . parseInt ( minuteStr . toString ( "0" ) ) ; mdt . setMinuteOfHour ( minute ) ; } } ret . add ( mdt . toDateTime ( ) ) ; } } } return ret ; }
Method to get for the parameters returned from the form as a datetimes .