使用 jodatime 解析日期对象不起作用

parsing date object with jodatime not working

当我尝试解析格式类似于 1950-01-01T00:00:00 的 Date 对象时,日期时间将其设置为昨天。

我也尝试过使用 DateTimeZone.getDefault() 获取时区,但仍然无法正常工作。 我可以使用哪个时区来修复它?

DateTime dateTime = new DateTime(1950-01-01T00:00:00, DateTimeZone.UTC);

output:
dateTime.getDayOfMonth() = 31
dateTime.getMonthOfYear() = 12
dateTime.getYear() = 1949

你能帮帮我吗?

谢谢。

通过在应用程序中添加以下代码修复 class

DateTimeZone.setDefault(DateTimeZone.forID("Europe/Istanbul"));