Install tyme4j via Maven
masterTo use tyme4j in your Java project, add the following dependency to your pom.xml file.
<dependency>
<groupId>cn.6tail</groupId>
<artifactId>tyme4j</artifactId>
<version>1.5.1</version>
</dependency>repository·master·Indexed 42 days ago
https://github.com/6tail/tyme4jA Java calendar utility library providing support for multiple calendar systems, including Gregorian, Lunar, Tibetan (Rab Byung), Hijri, zodiacs, sexagenary cycles, solar terms, lunar phases, and statutory holidays. Version 1.5.1 utilizes the SolarDay class as the primary entry point for date conversions.
To use tyme4j in your Java project, add the following dependency to your pom.xml file.
<dependency>
<groupId>cn.6tail</groupId>
<artifactId>tyme4j</artifactId>
<version>1.5.1</version>
</dependency>The SolarDay class is the primary entry point for working with Gregorian (Solar) dates. You can create a SolarDay instance using fromYmd(year, month, day) and then retrieve corresponding dates in other calendar systems such as Lunar, Rab Byung (Tibetan), and Hijri (Islamic).
import com.tyme.solar.SolarDay;
public class Sample {
public static void main(String[] args) {
// Create a SolarDay (Gregorian) instance
SolarDay solarDay = SolarDay.fromYmd(1986, 5, 29);
// Prints the Gregorian date
System.out.println(solarDay);
// Prints the Lunar date (e.g., 农历丙寅年四月廿一)
System.out.println(solarDay.getLunarDay());
// Prints the Rab Byung date (e.g., 第十七饶迥火虎年四月廿一)
System.out.println(solarDay.getRabByungDay());
// Prints the Hijri date (e.g., 1406年赖买丹月20日)
System.out.println(solarDay.getHijriDay());
}
}