PHPackages                             shijunjun/calendar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. shijunjun/calendar

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

shijunjun/calendar
==================

农历（阴历）转阳历（公历）,以及相关节日的查询

v1.0(7y ago)43.8kMITPHPPHP &gt;=5.5

Since May 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/shijunjun/Calendar)[ Packagist](https://packagist.org/packages/shijunjun/calendar)[ RSS](/packages/shijunjun-calendar/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

介绍
==

[](#介绍)

公历转农历,整合日历,在原有的基础上增加了根据给定日期返回节日以及二十节气的时间

安装
==

[](#安装)

```
composer require shijunjun/calendar
```

用法
==

[](#用法)

```
// 根据制定日期查询农历相关信息
use shijunjun\Calendar\Calendar;
require_once __DIR__ . '/vendor/autoload.php';
$calendar = new Calendar();
var_export($calendar->solar2lunar(2019, 3, 6,10)); 	// 转农历不包扩阳历日期以及星座
var_export($calendar->solar(2019, 3, 6,10));		// 转农历包扩阳历日期以及星座

// 返回结果
array (
    'lunar_year' => '2019', 				// 农历数字年
    'lunar_month' => '01', 				// 农历数字月
    'lunar_day' => '30',					// 农历数字日
    'lunar_hour' => '10',				// 农历数字时
    'lunar_year_chinese' => '二零一九',		// 农历汉字年
    'lunar_month_chinese' => '正月',		// 农历汉字月
    'lunar_day_chinese' => '三十',			// 农历汉字日
    'lunar_hour_chinese' => '巳时',		// 农历汉字时
    'ganzhi_year' => '己亥',				// 干支年
    'ganzhi_month' => '丁卯',				// 干支月
    'ganzhi_day' => '壬寅',				// 干支日
    'ganzhi_hour' => '乙巳',				// 干支时
    'wuxing_year' => '土水',				// 五行年
    'wuxing_month' => '火木',				// 五行月
    'wuxing_day' => '水木',				// 五行日
    'wuxing_hour' => '木火',				// 五行时
    'color_year' => '黄',				// 干支转色彩年
    'color_month' => '红',				// 干支转色彩月
    'color_day' => '黑',					// 干支转色彩日
    'color_hour' => '青',				// 干支转色彩时
    'animal' => '猪',					// 生肖
    'term' => '惊蛰',					// 二十四节气&阴历节日&阳历节日
    'term_date' => '2019-03-06 05:08:53',	// 二十节气时间
    'is_leap' => false,					// 是否闰年
);
array (
    'lunar_year' => '2019', 				// 农历数字年
    'lunar_month' => '01', 				// 农历数字月
    'lunar_day' => '30',					// 农历数字日
    'lunar_hour' => '10',				// 农历数字时
    'lunar_year_chinese' => '二零一九',		// 农历汉字年
    'lunar_month_chinese' => '正月',		// 农历汉字月
    'lunar_day_chinese' => '三十',			// 农历汉字日
    'lunar_hour_chinese' => '巳时',		// 农历汉字时
    'ganzhi_year' => '己亥',				// 干支年
    'ganzhi_month' => '丁卯',				// 干支月
    'ganzhi_day' => '壬寅',				// 干支日
    'ganzhi_hour' => '乙巳',				// 干支时
    'wuxing_year' => '土水',				// 五行年
    'wuxing_month' => '火木',				// 五行月
    'wuxing_day' => '水木',				// 五行日
    'wuxing_hour' => '木火',				// 五行时
    'color_year' => '黄',				// 干支转色彩年
    'color_month' => '红',				// 干支转色彩月
    'color_day' => '黑',					// 干支转色彩日
    'color_hour' => '青',				// 干支转色彩时
    'animal' => '猪',					// 生肖
    'term' => '惊蛰',					// 二十四节气&阴历节日&阳历节日
    'term_date' => '2019-03-06 05:08:53',	// 二十节气时间
    'is_leap' => false,					// 是否闰年
    'gregorian_year' => '2019',			// 阳历年
    'gregorian_month' => '03',			// 阳历月
    'gregorian_day' => '06',				// 阳历日
    'gregorian_hour' => '10',				// 阳历时
    'week_no' => 3,						// 数字星期
    'week_name' => '星期三',				// 汉字星期
    'is_today' => false,					// 是否当日
    'constellation' => '双鱼',			// 星座
);

```

参考
==

[](#参考)

- [公历转农历的计算代码采用的是(overtrue/chinese-calendar)](https://github.com/overtrue/chinese-calendar)
- [二十四节气的算法采用的是Re\*\*\*@foxmail.com分享出来的代码](http://damigen.com/)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2590d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/28e2e837a983a766e0eb9293408948e8caa9bc07d9883e3e39c4585a4fd89362?d=identicon)[shijunjun](/maintainers/shijunjun)

---

Top Contributors

[![shijunjun](https://avatars.githubusercontent.com/u/7324365?v=4)](https://github.com/shijunjun "shijunjun (3 commits)")

---

Tags

calendarChinese

### Embed Badge

![Health badge](/badges/shijunjun-calendar/health.svg)

```
[![Health](https://phpackages.com/badges/shijunjun-calendar/health.svg)](https://phpackages.com/packages/shijunjun-calendar)
```

###  Alternatives

[overtrue/pinyin

Chinese to pinyin translator.

4.5k6.8M76](/packages/overtrue-pinyin)[eluceo/ical

The eluceo/iCal package offers an abstraction layer for creating iCalendars. You can easily create iCal files by using PHP objects instead of typing your \*.ics file by hand. The output will follow RFC 5545 as best as possible.

1.2k18.3M57](/packages/eluceo-ical)[spatie/icalendar-generator

Build calendars in the iCalendar format

6868.2M15](/packages/spatie-icalendar-generator)[spatie/laravel-google-calendar

Manage events on a Google Calendar

1.4k1.7M21](/packages/spatie-laravel-google-calendar)[league/period

Time range API for PHP

7335.7M22](/packages/league-period)[overtrue/chinese-calendar

中国农历转换与查询工具

544110.6k5](/packages/overtrue-chinese-calendar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
