https://api.andeer.top/API/calendar_trans.php
https://api.andeer.top/API/calendar_trans.php
支持阳历转农历、农历转阳历、节气、生肖、干支、星座、日期计算等13种功能,通过type参数指定。
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| type | string | 是 | 操作类型(见说明) |
| year | integer | 否 | 年份(公历或农历) |
| month | integer | 否 | 月份(1-12或1-13) |
| day | integer | 否 | 日期(1-31) |
| lunar_year | integer | 否 | 农历年 |
| lunar_month | integer | 否 | 农历月 |
| lunar_day | integer | 否 | 农历日 |
| is_leap | boolean | 否 | 是否闰月 |
| hour | integer | 否 | 小时(0-23) |
| op | string | 否 | 操作(用于计算) |
| amount | integer | 否 | 数值(用于加减) |
| y1 | integer | 否 | 第一个年 |
| m1 | integer | 否 | 第一个月 |
| d1 | integer | 否 | 第一个日 |
| y2 | integer | 否 | 第二个年 |
| m2 | integer | 否 | 第二个月 |
| d2 | integer | 否 | 第二个日 |
| 状态码 | 说明 |
|---|---|
| 200 | 请求成功,服务器已成功处理了请求。 |
| 403 | 服务器拒绝请求。这可能是由于缺少必要的认证凭据(如API密钥)或权限不足。 |
| 404 | 请求的资源未找到。请检查您的请求地址是否正确。 |
| 429 | 请求过于频繁。您已超出速率限制,请稍后再试。 |
| 500 | 服务器内部错误。服务器在执行请求时遇到了问题。 |
此处将显示接口返回结果...
<?php
$url = 'https://api.andeer.top/API/calendar_trans.php';
$params = ['type' => 'YOUR_VALUE', 'year' => 'YOUR_VALUE', 'month' => 'YOUR_VALUE', 'day' => 'YOUR_VALUE', 'lunar_year' => 'YOUR_VALUE', 'lunar_month' => 'YOUR_VALUE', 'lunar_day' => 'YOUR_VALUE', 'is_leap' => 'YOUR_VALUE', 'hour' => 'YOUR_VALUE', 'op' => 'YOUR_VALUE', 'amount' => 'YOUR_VALUE', 'y1' => 'YOUR_VALUE', 'm1' => 'YOUR_VALUE', 'd1' => 'YOUR_VALUE', 'y2' => 'YOUR_VALUE', 'm2' => 'YOUR_VALUE', 'd2' => 'YOUR_VALUE', ];
$url .= '?' . http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>import requests
url = "https://api.andeer.top/API/calendar_trans.php"
params = {
'type': 'YOUR_VALUE',
'year': 'YOUR_VALUE',
'month': 'YOUR_VALUE',
'day': 'YOUR_VALUE',
'lunar_year': 'YOUR_VALUE',
'lunar_month': 'YOUR_VALUE',
'lunar_day': 'YOUR_VALUE',
'is_leap': 'YOUR_VALUE',
'hour': 'YOUR_VALUE',
'op': 'YOUR_VALUE',
'amount': 'YOUR_VALUE',
'y1': 'YOUR_VALUE',
'm1': 'YOUR_VALUE',
'd1': 'YOUR_VALUE',
'y2': 'YOUR_VALUE',
'm2': 'YOUR_VALUE',
'd2': 'YOUR_VALUE',
}
response = requests.get(url, params=params)
print(response.text)const url = new URL('https://api.andeer.top/API/calendar_trans.php');
const params = {
'type': 'YOUR_VALUE',
'year': 'YOUR_VALUE',
'month': 'YOUR_VALUE',
'day': 'YOUR_VALUE',
'lunar_year': 'YOUR_VALUE',
'lunar_month': 'YOUR_VALUE',
'lunar_day': 'YOUR_VALUE',
'is_leap': 'YOUR_VALUE',
'hour': 'YOUR_VALUE',
'op': 'YOUR_VALUE',
'amount': 'YOUR_VALUE',
'y1': 'YOUR_VALUE',
'm1': 'YOUR_VALUE',
'd1': 'YOUR_VALUE',
'y2': 'YOUR_VALUE',
'm2': 'YOUR_VALUE',
'd2': 'YOUR_VALUE',
};
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));
fetch(url)
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));{
"success": true,
"code": 200,
"msg": "请通过 type 参数指定操作类型",
"data": {
"available_types": {
"solar_to_lunar": "阳历(公历)转农历,支持时辰(需传 year\/month\/day\/hour)",
"lunar_to_solar": "农历转阳历,支持闰月标识(需传 lunar_year\/lunar_month\/lunar_day\/is_leap\/hour)",
"year_info": "获取某农历年的总天数与总月数(需传 year)",
"leap_month": "查询某农历年是否有闰月,返回闰几月(需传 year)",
"lunar_days": "获取农历某年某月的天数(需传 year\/month)",
"solar_days": "获取公历某年某月的天数(自动处理闰年,需传 year\/month)",
"ganzhi_year": "获取某年的干支纪年(如“乙巳”,需传 year)",
"constellation": "根据月日获取星座(需传 month\/day)",
"to_china": "将数字转为中文(年\/月\/日,需传 part=num 和 num)",
"animal": "获取某年的生肖(如“蛇”,需传 year)",
"term": "获取某年第 N 个节气的公历日期(1=小寒, ..., 24=冬至,需传 year\/term_index)",
"lunar_calculate": "对农历日期进行加减运算(年\/月\/日,需传 op\/year\/month\/day\/amount)",
"lunar_diff": "计算两个农历日期之间相差的年、月、天数(需传 y1\/m1\/d1\/leap1 和 y2\/m2\/d2\/leap2)"
}
},
"text": {
"copyright": "Aurora 2022.8.14",
"time": "当前时间为:2025-12-22 01:58:22"
}
}