public static Date parseEpochTimestamp ( String value ) { Date result = null ; if ( value . length ( ) > 0 ) { if ( ! value . equals ( "-1 -1" ) ) { Calendar cal = DateHelper . popCalendar ( JAVA_EPOCH ) ; int index = value . indexOf ( ' ' ) ; if ( index == - 1 ) { if ( value . length ( ) < 6 ) { value = "000000" + value ; value = value . substring ( value . length ( ) - 6 ) ; } int hours = Integer . parseInt ( value . substring ( 0 , 2 ) ) ; int minutes = Integer . parseInt ( value . substring ( 2 , 4 ) ) ; int seconds = Integer . parseInt ( value . substring ( 4 ) ) ; cal . set ( Calendar . HOUR , hours ) ; cal . set ( Calendar . MINUTE , minutes ) ; cal . set ( Calendar . SECOND , seconds ) ; } else { long astaDays = Long . parseLong ( value . substring ( 0 , index ) ) ; int astaSeconds = Integer . parseInt ( value . substring ( index + 1 ) ) ; cal . add ( Calendar . DAY_OF_YEAR , ( int ) ( astaDays - ASTA_EPOCH ) ) ; cal . set ( Calendar . MILLISECOND , 0 ) ; cal . set ( Calendar . SECOND , 0 ) ; cal . set ( Calendar . HOUR , 0 ) ; cal . add ( Calendar . SECOND , astaSeconds ) ; } result = cal . getTime ( ) ; DateHelper . pushCalendar ( cal ) ; } } return result ; }
Parse the string representation of a timestamp .