private Date getDateTime ( String value ) throws MPXJException { try { Number year = m_fourDigitFormat . parse ( value . substring ( 0 , 4 ) ) ; Number month = m_twoDigitFormat . parse ( value . substring ( 4 , 6 ) ) ; Number day = m_twoDigitFormat . parse ( value . substring ( 6 , 8 ) ) ; Number hours = m_twoDigitFormat . parse ( value . substring ( 9 , 11 ) ) ; Number minutes = m_twoDigitFormat . parse ( value . substring ( 11 , 13 ) ) ; Calendar cal = DateHelper . popCalendar ( ) ; cal . set ( Calendar . YEAR , year . intValue ( ) ) ; cal . set ( Calendar . MONTH , month . intValue ( ) - 1 ) ; cal . set ( Calendar . DAY_OF_MONTH , day . intValue ( ) ) ; cal . set ( Calendar . HOUR_OF_DAY , hours . intValue ( ) ) ; cal . set ( Calendar . MINUTE , minutes . intValue ( ) ) ; cal . set ( Calendar . SECOND , 0 ) ; cal . set ( Calendar . MILLISECOND , 0 ) ; Date result = cal . getTime ( ) ; DateHelper . pushCalendar ( cal ) ; return result ; } catch ( ParseException ex ) { throw new MPXJException ( "Failed to parse date-time " + value , ex ) ; } }
Convert a Planner date - time value into a Java date .