MENU

优雅的将阳历转为农历

• August 19, 2019 • Read: 1283 • Web Program

农历Api

请求格式 /GET
https://api.xiaohuwei.cn/data/index.php //今天
https://api.xiaohuwei.cn/data/index.php?type=now //请求当前月所有农历
https://api.xiaohuwei.cn/data/index.php?type=10  //请求10月份所有农历
https://api.xiaohuwei.cn/data/index.php?year=2019&month=10&day=1 //请求2019年10月1日
返回数据
{
    "code": 200,
    "msg": "获取成功",
    "tag": "自豪的来自肖虎威博客:blog.xiaohuwei.cn",
    "content": {
        "year": 2019,
        "month": 10,
        "day": 1,
        "zodiac": "猪",
        "GanZhiYear": "己亥",
        "GanZhiMonth": "癸酉",
        "GanZhiDay": "辛未",
        "worktime": 0,
        "term": "",
        "lunarYear": 2019,
        "lunarMonth": 9,
        "lunarDay": 3,
        "lunarMonthName": "九月",
        "lunarDayName": "初三",
        "lunarLeapMonth": 0,
        "solarFestival": "国庆节 世界音乐日 国际老人节",
        "lunarFestival": "",
        "isBigMonth": false
    }
}
当然 你也可以这样
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.xiaohuwei.cn/calendar.js"></script>
</head>
<body>
</body>
<script>
    let nong = calendar.solar2lunar(2019, 10, 1);
    console.log(nong)
</script>
</html>
Last Modified: August 23, 2019
Leave a Comment