Logo Search packages:      
Sourcecode: icu version File versions

UnicodeString & DateIntervalFormat::format ( const DateInterval dtInterval,
UnicodeString appendTo,
FieldPosition fieldPosition,
UErrorCode status 
) const

Format a DateInterval to produce a string.

Parameters:
dtInterval DateInterval to be formatted.
appendTo Output parameter to receive result. Result is appended to existing contents.
fieldPosition On input: an alignment field, if desired. On output: the offsets of the alignment field.
status Output param filled with success/failure status.
Returns:
Reference to 'appendTo' parameter. ICU 4.0

Definition at line 254 of file dtitvfmt.cpp.

References fDateFormat, fFromCalendar, fInfo, format(), DateInterval::getFromDate(), DateInterval::getToDate(), NULL, Calendar::setTime(), U_FAILURE, and U_SUCCESS.

                                                     {
    if ( U_FAILURE(status) ) {
        return appendTo;
    }

    if ( fFromCalendar != NULL && fToCalendar != NULL && 
         fDateFormat != NULL && fInfo != NULL ) {
        fFromCalendar->setTime(dtInterval->getFromDate(), status);
        fToCalendar->setTime(dtInterval->getToDate(), status);
        if ( U_SUCCESS(status) ) {
            return format(*fFromCalendar, *fToCalendar, appendTo,fieldPosition, status);
        }
    }
    return appendTo;
}


Generated by  Doxygen 1.6.0   Back to index