Code example for ParsePosition

Methods: setIndex

0
        d.setMonth(Integer.parseInt(text.substring(5, 7)) - 1);
        d.setDate(Integer.parseInt(text.substring(8, 10)));
        d.setHours(0); 
        d.setMinutes(0); 
        d.setSeconds(0); 
        pos.setIndex(10);
        return d; 
    } 
} 
 
 
// format : HHmmss 
class FastDateFormatOfHHmmss 
        extends DateFormat {
    protected final String pattern = "HHmmss";
 
    public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
        toAppendTo.append(StringUtil.leftPadding(2, '0', String.valueOf(date.getHours())));
        toAppendTo.append(StringUtil.leftPadding(2, '0', String.valueOf(date.getMinutes())));
        toAppendTo.append(StringUtil.leftPadding(2, '0', String.valueOf(date.getSeconds())));
        fieldPosition.setBeginIndex(0);