Your pattern is not correct. Use yyyy-MM-dd HH:mm:ss Z z
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
public class Main {
public static void main(String[] args) {
String timestamp = "2021-02-03 23:22:23 +0000 UTC";
DateTimeFormatter fmtInput = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss Z z");
DateTime dtSource = fmtInput.parseDateTime(timestamp);
System.out.println(dtSource);
}
}
Output:
2021-02-03T23:22:23.000Z
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…