public String getFMDate ( ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( this ) ; StringBuilder sb = new StringBuilder ( 15 ) ; int hour = cal . get ( Calendar . HOUR_OF_DAY ) ; if ( hour == 0 && hasTime ) { hour = 24 ; cal . add ( Calendar . DAY_OF_MONTH , - 1 ) ; } addFMPiece ( sb , cal . get ( Calendar . YEAR ) - 1700 , 0 ) ; addFMPiece ( sb , cal . get ( Calendar . MONTH ) + 1 , 2 ) ; addFMPiece ( sb , cal . get ( Calendar . DAY_OF_MONTH ) , 2 ) ; if ( hasTime ) { sb . append ( ' ' ) ; addFMPiece ( sb , hour , 2 ) ; addFMPiece ( sb , cal . get ( Calendar . MINUTE ) , 2 ) ; addFMPiece ( sb , cal . get ( Calendar . SECOND ) , 2 ) ; addFMPiece ( sb , cal . get ( Calendar . MILLISECOND ) , 2 ) ; for ( int i = sb . length ( ) - 1 ; i >= 0 ; i -- ) { char c = sb . charAt ( i ) ; if ( c == ' ' ) { sb . deleteCharAt ( i ) ; } else if ( c == ' ' ) { sb . deleteCharAt ( i ) ; break ; } else { break ; } } } return sb . toString ( ) ; }
Returns the FM string representation of the date .