接口路径(新):http://api.okayapi.com/api/App/Common_Date/GetDaysFromNow
接口路径(旧):http://api.okayapi.com/?s=App.Common_Date.GetDaysFromNow
接口描述: 根据输入的日期返回一个整数
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
yearStart | Int | Optaion | 2016 | 起始年份,默认2016,值 0-69 会映射为 2000-2069,值 70-100 会映射为 1970-2000起始年份 不是整型的数会转成0 | |
monthStart | Int | Optaion | 2 | 起始月份,默认2,值 0-12 | |
dayStart | Int | Optaion | 9 | 起始天数,默认9,值 0-31 |
请求(第一个示例:从省份开始选择):
{OKAYAPI_API_HOST}/?s=App.Common_Date.getDaysFromNow&yearStart=2016&monthStart=2&dayStart=9
返回:
{
"ret": 200,
"data": {
"err_code": 0,
"err_msg": "",
"diff": "1127"
},
"msg": "小白开放接口:App.Common_Date.getDaysFromNow"
}
<?php
// 引入文件
require_once dirname(__FILE__) . '/OkayApiClient.php';
// 调用小白开放接口
$yearStart = 2016;
$monthStart = 2;
$dayStart = 9;
$rs = OkayApiClient::request('App.Common_Date.GetDaysFromNow', array('yearStart' => $yearStart,'monthStart' => $monthStart,'dayStart' => $dayStart));
// 输出结果
print_r($rs);
/*
Array
(
[ret] => 200
[data] => Array
(
[err_code] => 0
[err_msg] =>
[diff] => 1127
)
[msg] => 小白开放接口:App.Common_Date.GetDaysFromNow
)
*/
KEY | Type | Description |
---|---|---|
yearStart | Int | 起始年份,默认2016,值 1-69 会映射为 2001-2069,值 70-100 会映射为 1970-2000 不是整型的数会转成0 |
monthStart | Int | 起始月份,默认2,值 1-12 不是整型的数会转成0 |
dayStart | Int | 起始日期,默认9,值 1-31 不是整型的数会转成0 |
接口路径(新):http://api.okayapi.com/api/App/Common_Date/GetDaysDiff
接口路径(旧):http://api.okayapi.com/?s=App.Common_Date.GetDaysDiff
接口描述: 根据输入的两日期差返回一个整数
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
yearStart | Int | Required | 起始年份,值 0-69 会映射为 2000-2069,值 70-100 会映射为 1970-2000 | ||
monthStart | Int | Required | 起始月份,值 0-12 | ||
dayStart | Int | Required | 起始天数,值 0-31 | ||
yearEnd | Int | Required | 结束年份,值 0-69 会映射为 2000-2069,值 70-100 会映射为 1970-2000 | ||
monthEnd | Int | Required | 结束月份,值 0-12 | ||
dayEnd | Int | Required | 结束天数,可选,值 0-31 |
请求(第一个示例:从省份开始选择):
{OKAYAPI_API_HOST}/?s=App.Common_Date.getDaysDiff&yearStart=2016&monthStart=2&dayStart=9&yearEnd=2019&monthEnd=3&dayEnd=12
返回:
{
"ret": 200,
"data": {
"err_code": 0,
"err_msg": "",
"diff": "1127"
},
"msg": "小白开放接口:App.Common_Date.getDaysDiff"
}
<?php
// 引入文件
require_once dirname(__FILE__) . '/OkayApiClient.php';
// 调用小白开放接口
$yearStart = 2016;
$monthStart = 2;
$dayStart = 9;
$yearEnd = 2019;
$monthEnd = 3;
$dayEnd = 12;
$rs = OkayApiClient::request('App.Common_Date.GetDaysFromNow', array('yearStart' => $yearStart,'monthStart' => $monthStart,'dayStart' => $dayStart,'yearEnd' => $yearEnd,'monthEnd' => $monthEnd,'dayEnd' => $dayEnd));
// 输出结果
print_r($rs);
/*
Array
(
[ret] => 200
[data] => Array
(
[err_code] => 0
[err_msg] =>
[diff] => 1127
)
[msg] => 小白开放接口:App.Common_Date.GetDaysDiff
)
*/
KEY | Type | Description |
---|---|---|
yearStart | Int | 起始年份,值 1-69 会映射为 2001-2069,值 70-100 会映射为 1970-2000 不是整型的数会转成0 |
monthStart | Int | 起始月份,值 1-12 不是整型的数会转成0 |
dayStart | Int | 起始日期,值 1-31 不是整型的数会转成0 |
yearEnd | Int | 结束年份,值 1-69 会映射为 2001-2069,值 70-100 会映射为 1970-2000 不是整型的数会转成0 |
monthEnd | Int | 结束月份,值 1-12 不是整型的数会转成0 |
dayEnd | Int | 结束日期,值 1-31 不是整型的数会转成0 |
接口路径(新):http://api.okayapi.com/api/App/Common_Date/ChangeIntoLunar
接口路径(旧):http://api.okayapi.com/?s=App.Common_Date.ChangeIntoLunar
接口描述: 根据输入的日期返回农历日期如2019-3-12->二月初六
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
yearStart | Int | Optaion | 2016 | 阳历年份,默认2016,值 0-69 会映射为 2000-2069,值 70-100 会映射为 1970-2000 | |
monthStart | Int | Optaion | 2 | 阳历月份,默认2,值 0-12 | |
dayStart | Int | Optaion | 9 | 阳历天数,默认9,值 0-31 |
请求(第一个示例:从省份开始选择):
{OKAYAPI_API_HOST}/?s=App.Common_Date.ChangeIntoLunar&yearStart=2016&monthStart=2&dayStart=9&app_key={你的app_key}&sign={动态签名}
返回:
{
"ret": 200,
"data": {
"err_code": 0,
"err_msg": "",
"lunarDate": "正月初二"
},
"msg": "小白开放接口:App.Common_Date.ChangeIntoLunar"
}
<?php
// 引入文件
require_once dirname(__FILE__) . '/OkayApiClient.php';
// 调用小白开放接口
$yearStart = 2016;
$monthStart = 2;
$dayStart = 9;
$rs = OkayApiClient::request('App.Common_Date.ChangeIntoLunar', array('yearStart' => $yearStart,'monthStart' => $monthStart,'dayStart' => $dayStart));
// 输出结果
print_r($rs);
/*
Array
(
[ret] => 200
[data] => Array
(
[err_code] => 0
[err_msg] =>
[lunarDate] => "正月初二"
)
[msg] => 小白开放接口:App.Common_Date.ChangeIntoLunar
)
*/
KEY | Type | Description |
---|---|---|
yearStart | Int | 起始年份,默认2016,值 1-69 会映射为 2001-2069,值 70-100 会映射为 1970-2000 不是整型的数会转成0 |
monthStart | Int | 起始月份,默认2,值 1-12 不是整型的数会转成0 |
dayStart | Int | 起始日期,默认9,值 1-31 不是整型的数会转成0 |
接口路径(新):http://api.okayapi.com/api/App/Common_Date/ChangeIntoNation
接口路径(旧):http://api.okayapi.com/?s=App.Common_Date.ChangeIntoNation
接口描述: 根据输入的日期返回阳历日期如2019-1-1->2019-2-5(现只支持到2031年)
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
yearStart | Int | Optaion | 2016 | 阳历年份,默认2016,值 0-69 会映射为 2000-2069,值 70-100 会映射为 1970-2000 | |
monthStart | Int | Optaion | 2 | 阳历月份,默认2,值 0-12 | |
dayStart | Int | Optaion | 9 | 阳历天数,默认9,值 0-31 |
KEY | Type | Description |
---|---|---|
yearStart | Int | 起始年份,默认2016,值 1-69 会映射为 2001-2069,值 70-100 会映射为 1970-2000 不是整型的数会转成0 |
monthStart | Int | 起始月份,默认2,值 1-12 不是整型的数会转成0 |
dayStart | Int | 起始日期,默认9,值 1-31 不是整型的数会转成0 |
接口路径(新):http://api.okayapi.com/api/App/Common_Date/Curtime
接口路径(旧):http://api.okayapi.com/?s=App.Common_Date.Curtime
接口描述: 获取时间,日期、年份、星期等
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
timestamp | Int | Optaion | 0 | MIN: 0 | 当前时间戳,未指定时使用当前系统时间。 |
KEY | Type | Description |
---|---|---|
timestamp | Int | 时间戳,例如:1564622918 |
datetime | String | 日期时间,例如:2019-08-01 00:00:00 |
date | String | 日期,例如:2019-08-01 |
date_md_zh | String | 中文日期,月份和天前面有0,例如:2019年08月01日 |
date_Nj_zh | String | 中文日期,月份和天前面没有0,例如:2019年8月1日 |
time_H | String | 时间,24 小时格式,例如:18:00:00 |
time_h | String | 时间,12 小时格式,例如:06:00:00 |
day_d | String | 日,月份中的第几天,有前导零的 2 位数字,01 到 31 |
day_j | String | 日,月份中的第几天,没有前导零,1 到 31 |
day_N | String | 日,星期中的第几天,1(表示星期一)到 7(表示星期天) |
day_N_zh | String | 日,星期一到星期天 |
day_z | String | 日,年份中的第几天,0 到 365 |
week_W | String | 星期,年份中的第几周,每周从星期一开始,例如:42(当年的第 42 周) |
month_m | String | 月,数字表示的月份,有前导零,01 到 12 |
month_n | String | 月,数字表示的月份,没有前导零,1 到 12 |
month_n_zh | String | 月,一月到十二月 |
year_Y | String | 年,4 位数字完整表示的年份,例如:1999 或 2003 |
hour_g | String | 小时,12 小时格式,没有前导零,1 到 12 |
hour_G | String | 小时,24 小时格式,没有前导零,0 到 23 |
hour_h | String | 小时,12 小时格式,有前导零,01 到 12 |
hour_H | String | 小时,24 小时格式,有前导零,00 到 23 |
minute_i | String | 分钟,有前导零的分钟数,00 到 59 |
second_s | String | 秒数,有前导零,00 到 59 |
接口路径(新):http://api.okayapi.com/api/App/Common_Date/GetSolarTerms
接口路径(旧):http://api.okayapi.com/?s=App.Common_Date.GetSolarTerms
接口描述: 输入年份获取 上一年冬至 ~ 下一年冬至
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
year | Int | Required | 0 | 年 |
KEY | Type | Description |
---|---|---|
年 | data.list.Y | |
月 | data.list.M | |
日 | data.list.D | |
节气名字 | data.list.solarTermsName |
接口路径(新):http://api.okayapi.com/api/App/Common_Date/GetSolarTermsStarByDay
接口路径(旧):http://api.okayapi.com/?s=App.Common_Date.GetSolarTermsStarByDay
接口描述: 输入年 year 月 month 日 day 输出对应的节气和星座
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
year | Int | Required | 0 | 年 | |
month | Int | Required | 1 | MIN: 1;MAX: 12 | 月 |
day | Int | Required | 1 | MIN: 1;MAX: 31 | 日 |
KEY | Type | Description |
---|---|---|
星座 | data.solarTerms.D | |
节气名字 | data.solarTermsName |
Power by OkayAPI.com Contact us (WA: okayapi OR Email: chanzonghuang@gmail.com).
Timezone: America/New_York May/09/2025 07:38:03