## 获取年、月、日 ### 获取数字表示 1. .getYear() > 获取道历年的数字 2. .getMonth() > 获取道历月的数字,值从1到12,但闰月为负数,如闰二月=-2。 3. .getDay() > 获取道历日的数字 ### 获取中文表示 1. .getYearInChinese() > 获取道历年的中文 2. .getMonthInChinese() > 获取道历月的中文 3. .getDayInChinese() > 获取道历日的中文 ### 示例代码
javascript
java
csharp
php
python
go
var d = Tao.fromLunar(Lunar.fromDate(new Date())); console.log(d.getYear()); console.log(d.getMonth()); console.log(d.getDay()); console.log(d.getYearInChinese()); console.log(d.getMonthInChinese()); console.log(d.getDayInChinese());
Tao d = Tao.fromLunar(Lunar.fromDate(new Date())); System.out.println(d.getYear()); System.out.println(d.getMonth()); System.out.println(d.getDay()); System.out.println(d.getYearInChinese()); System.out.println(d.getMonthInChinese()); System.out.println(d.getDayInChinese());
Tao d = Tao.fromLunar(Lunar.fromDate(new Date())); Console.WriteLine(d.getYear()); Console.WriteLine(d.getMonth()); Console.WriteLine(d.getDay()); Console.WriteLine(d.getYearInChinese()); Console.WriteLine(d.getMonthInChinese()); Console.WriteLine(d.getDayInChinese());
$d = Tao::fromLunar(Lunar::fromDate(new DateTime())); echo $d->getYear()."\n"; echo $d->getMonth()."\n"; echo $d->getDay()."\n"; echo $d->getYearInChinese()."\n"; echo $d->getMonthInChinese()."\n"; echo $d->getDayInChinese()."\n";
d = Tao.fromLunar(Lunar.fromDate(datetime.now())) print d.getYear() print d.getMonth() print d.getDay() print d.getYearInChinese() print d.getMonthInChinese() print d.getDayInChinese()
d := calendar.NewTaoFromLunar(calendar.NewLunarFromDate(time.Now())) fmt.Println(d.GetYear()) fmt.Println(d.GetMonth()) fmt.Println(d.GetDay()) fmt.Println(d.GetYearInChinese()) fmt.Println(d.GetMonthInChinese()) fmt.Println(d.GetDayInChinese())
### 输出