Of course, it is impossible without an external library, because standard Java does not contain a Chinese calendar. Calculating the Chinese New Year requires complex astronomical calculations, and standard Java also does not support astronomy.
As a workaround, use my Time4J library (v4.35), and then write the following code:
LocalDate gregorian = LocalDate.now(ZoneId.of("Asia/Shanghai")); ChineseCalendar cc = ChineseCalendar.ofNewYear(gregorian.getYear()); LocalDate newYearAsGregorian = cc.transform(PlainDate.axis()).toTemporalAccessor(); System.out.println( newYearAsGregorian);
See also API for details.
source share