2 xushaohui1019 xushaohui1019 于 2013.07.08 16:39 提问

joda匹配英文月份出错

以下是我匹配的时间,大神们,看看有什么问题:
propweties文件

18/Jun/2013 16:07:02 +0800

time_format_4 = dd/MMM/yyyy HH:mm:ss Z
代码:
DateTimeParser[] dateParsers = new DateTimeParser[getLength()+1];
Long timeStemp = null;
int i = 0;

    while (true) {
        String time_format = pc.get("time_format_" + i);

        System.out.println(time_format);

        if (time_format == null)
            break;

        dateParsers[i] = DateTimeFormat.forPattern(time_format).getParser();

        i++;
    }
    DateTimeFormatter formatter = new DateTimeFormatterBuilder().append(
            null, dateParsers).toFormatter();
    DateTime date = formatter.parseDateTime(time);
    timeStemp = date.toDate().getTime();
    return timeStemp;
}
Csdn user default icon
上传中...
上传图片
插入图片