Coder Social home page Coder Social logo

chinese-calendar's Introduction

Chinese calendar

📅 **农历(阴历)与阳历(公历)转换与查询工具

Installing

$ composer require overtrue/chinese-calendar -vvv

Usage

use Overtrue\ChineseCalendar\Calendar;

$calendar = new Calendar();

$result = $calendar->solar(2017, 5, 5); // 阳历
$result = $calendar->lunar(2017, 4, 10); // 阴历

结果:

{
    "lunar_year": 2017,                 // 农历年
    "lunar_month": 4,                   // 农历月
    "lunar_day": 10,                    // 农历日
    "lunar_month_chinese": "四月",       // (汉字)农历月
    "lunar_day_chinese": "初十",         // (汉字)农历日  
    "ganzhi_year": "丁酉",               // (干支)年
    "ganzhi_month": "乙巳",              // (干支)月
    "ganzhi_day": "壬辰",                // (干支)日
    "animal": "鸡",                      // 生肖
    "term": "立夏",                      // 节气
    "is_leap": false,                    // 是否为闰月
    "gregorian_year": 2017,              // 公历年
    "gregorian_month": 5,                // 公历月
    "gregorian_day": 5,                  // 公历日
    "week_no": 5,                        // (数字)星期几
    "week_name": "星期五",                // (汉字)星期几
    "is_today": false,                   // 是否为今天
    "constellation": "金牛"               // 星座
}

更多 API 请查看源码。

Reference

License

MIT

chinese-calendar's People

Contributors

overtrue avatar tinkoliu avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.