在Java中将AccountingDate(ChronoLocalDate)转换为Instant

I'm using the AccountingDate implemented into this project.

public final class AccountingDate extends AbstractDate implements ChronoLocalDate, Serializable {}

您知道一种将AccountingDate转换为Instant或LocalDate的方法吗?

评论
  • 我是大怪兽
    我是大怪兽 回复

    According to the documentation, AccountingDate inherits from ChronoLocalDate which is a subinterface of TemporalAccessor. So you should be able to call:

    Instant.from(accountingDate)
    

    where accountingDate is an instance of AccountingDate.