Java Joda构造函数的LocalDate表示构造函数LocalDate(int,int,int)不可见
根据Joda中的文件:Java Joda构造函数的LocalDate表示构造函数LocalDate(int,int,int)不可见,java,jodatime,Java,Jodatime,根据Joda中的文件: public LocalDate(int year, int monthOfYear, int dayOfMonth, Chronology chronology) 应该采取以上我所做的。我试图将“时间顺序”设置为空,但出现以下错误: The constructor LocalDate(int, int, int, null) is undefined 然而,我传递的是正确的值,但据我所知,空时间表示默认时区中的等时 因此,如何传递三个正确的整数
public LocalDate(int year,
int monthOfYear,
int dayOfMonth,
Chronology chronology)
应该采取以上我所做的。我试图将“时间顺序”设置为空,但出现以下错误:
The constructor LocalDate(int, int, int, null) is undefined
然而,我传递的是正确的值,但据我所知,空时间表示默认时区中的等时
因此,如何传递三个正确的整数值并正确使用构造函数
if (cit.hasNext()) {
cell = cit.next();
cell.setCellType(Cell.CELL_TYPE_NUMERIC);
if (DateUtil.isCellDateFormatted(cell))
{
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String cellValue = sdf.format(cell.getDateCellValue());
//System.out.println(cellValue);
//bufferDate is getting mm/dd/yyyy from excel cell
String[] dateSpliter = cellValue.split("/");
int month= Integer.parseInt(dateSpliter[0]);
int day= Integer.parseInt(dateSpliter[1]);
int year= Integer.parseInt(dateSpliter[2]);
_date = new LocalDate(year,month,day,null);
po.setDate(_date);
}
在我看来,你好像导入了错误的类
Java8类没有公共构造函数,但它有一个私有构造函数,它接受三个
int
值。我认为这个类是您错误地导入的,当时您想要的是org.joda.time.LocalDate。在我看来,您好像导入了错误的类
Java8类没有公共构造函数,但它有一个私有构造函数,它接受三个
int
值。我认为这个类是您错误地导入的,当时您想要的是org.joda.time.LocalDate。我知道这个问题很老,但您可以写:
LocalDate date = LocalDate.of(int, int, int);
我希望有人会觉得这很有帮助。我知道这个问题很老,但你可以写:
LocalDate date = LocalDate.of(int, int, int);
我希望有人会觉得这很有帮助。Joda的版本是什么?Dave的问题很重要,但我也注意到创建LocalDate的逻辑是多么复杂。为什么不使用LocalDate.fromDateFields(cell.getDateCellCalue())(请参见:)来代替这个复杂的逻辑,它涉及非常缓慢和庞大的SimpleDateFormat?您的标题与问题文本不匹配。你能解决这个问题吗?Joda的版本是什么?Dave的问题很重要,但我也注意到创建LocalDate的逻辑是多么复杂。为什么不使用LocalDate.fromDateFields(cell.getDateCellCalue())(请参见:)来代替这个复杂的逻辑,它涉及非常缓慢和庞大的SimpleDateFormat?您的标题与问题文本不匹配。你能修一下吗?