且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 Joda Time 解析包含时区的日期

更新时间:2023-09-19 23:19:46

好的,进一步谷歌搜索给了我自己问题的答案:使用 withOffsetParsed(),如下:

OK, further Googling gave me the answer to my own question: use withOffsetParsed(), as so:

final DateTimeFormatter df = DateTimeFormat
        .forPattern("EEE MMM dd HH:mm:ss 'GMT'Z yyyy");
final DateTime dateTime = df.withOffsetParsed()
        .parseDateTime("Mon Aug 24 12:36:46 GMT+1000 2009");

这行得通.