Powered by MarkdownBrain

判断指定日期是否为节假日

接口概述

本接口用于判断指定日期是否为节假日。

基本信息

  • 接口URL: /v1/is_holiday
  • 请求方式: GET
  • 接口描述: 判断指定日期是否为节假日

请求参数

参数名 类型 必填 说明
date string 需要查询的日期,格式见下方支持的格式列表

响应参数

参数名 类型 说明
is_holiday boolean true: 是节假日;false: 不是节假日
holiday string 节假日的名称(仅当 is_holidaytrue 时返回)
date string 查询的日期

请求示例

GET /v1/is_holiday?date=2024-03-15
curl -X GET "https://api.jiejiariapi.com/v1/is_holiday?date=2025-01-01"

成功响应

如果日期是节假日

{
    "is_holiday": true,
    "holiday": "春节",
    "date": "2024-02-10"
}

如果日期不是节假日:

{
    "is_holiday": false,
    "date": "2024-03-15"
}

其中 holiday 的数据类型与 获取年度节假日详情 结构保持一致。

失败响应

如果日期格式错误:

{
    "message": "不支持的日期格式,请查看 supported_formats 列表。",
    "supported_formats": [
        "2006-01-02 15:04:05",
        "2006-01-02 15:04",
        "2006-01-02 15",
        "2006-01-02"
        ...
    ]
}

支持的日期格式

以下日期格式是接口支持的输入格式:

格式示例 说明
2006-01-02 15:04:05 年-月-日 时:分:秒
2006-01-02 15:04 年-月-日 时:分
2006-01-02 15 年-月-日 时
2006-01-02 年-月-日
2006年01月02日 15时04分05秒 年月日时分秒(中文格式)
2006年01月02日 15时04分 年月日时分(中文格式)
2006年01月02日 15时 年月日时(中文格式)
2006年01月02日 年月日(中文格式)
02/01/2006 日/月/年
02/01/2006 15:04:05 日/月/年 时:分:秒
02/01/2006 15:04 日/月/年 时:分
02/01/2006 15 日/月/年 时

关于

https://jiejiariapi.com
🇨🇳中国节假日 API
免费的节假日接口 / 周六周日接口 / 工作日接口