Python判断节假日,以及节假日sql数据!

行业资讯 admin 发布时间:2024-06-11 浏览:15 次

为什么要判断节假日?

在我们的日常生活中,节假日是一个重要的组成部分。无论是个人计划还是商业活动,了解特定日期是否为节假日都是非常有用的。在Python中,我们可以使用一些内置的日期和时间模块来判断一个日期是否是法定节假日。

在数据分析工作中,判断节假日的使用场景主要有以下几个方面:

「销售数据分析:」 对于电商或线下零售商来说,节假日的销售数据可能与其他时间有所不同。通过判断节假日,可以对销售数据进行更准确的趋势分析和预测。「用户行为分析:」 在用户行为分析中,节假日的影响可能导致用户行为的变化。例如,节假日期间用户可能更倾向于浏览娱乐内容或进行短途旅行。「流量分析:」 对于许多在线业务,例如旅游、电影票预订或在线游戏等,节假日的流量波动是一个重要的分析点。通过判断节假日,可以更好地了解流量变化和用户需求。「媒体内容推荐:」 根据节假日的特点,可以为用户推荐相应主题的内容或广告。例如,在春节期间可以加强推荐与家人团聚或相关节日文化的内容。「市场活动规划:」 对于市场营销团队来说,节假日是策划活动的好时机。通过判断节假日,可以更精准地定位目标受众和制定营销策略。「物流配送优化:」 在物流和配送领域,节假日可能导致配送需求的增加或配送时间的延长。通过判断节假日,可以更好地规划运力和优化配送路线。「客户服务响应:」 在客户服务方面,节假日可能导致服务需求的增加或响应时间的延长。通过判断节假日,可以更好地调配资源和服务人员。「趋势预测:」 通过判断节假日,可以更准确地预测业务发展趋势和市场变化。例如,对于酒店业,可以利用历史数据预测节假日期间的入住率和房价。「安全风险预警:」 在某些领域,例如金融或网络安全,节假日可能带来更多的安全风险。通过数据分析,可以提前发现潜在的安全威胁并进行预警。

综上所述,判断节假日在数据分析工作中具有广泛的应用场景。通过合理利用节假日数据,可以更好地理解用户需求和市场变化,提高业务运营的效率和效果。

python如何判断节假日?

首先,我们需要导入Python的datetime模块。这个模块提供了日期和时间的各种操作,包括日期的比较、计算等。然后,我们还需要安装chinesecalendar模块,这个模块提供判断某年某月某一天是不是工作日/节假日。支持 2004年 至 2024年,包括 2020年 的春节延长。

import

 datetime

from chinese_calendar import

 is_holiday, is_workday

from chinese_calendar.constants import

 workdays, holidays

安装chinesecalendar

pip install chinesecalendar

更新chinesecalendar

pip install -U chinesecalendar

由于次年的节假日安排,取决于国务院发布的日程。所以本项目一般会在国务院更新以后,发布新的版本。按照以往的经验,一般是每年的 11月 前后发布新版本。

判断节假日和工作日

接下来,我们可以使用is_holiday和is_workday来判断给定的日期是否是法定节假日。

这两个函数接受一个日期对象作为参数,并返回一个布尔值来表示该日期是否为法定节假日。

现在,我们可以使用这个函数来判断任意给定的日期是否是法定节假日。例如:

import

 datetime

from chinese_calendar import

 is_holiday, is_workday

from chinese_calendar.constants import

 workdays, holidays

# 获取当前日期

now_ = datetime.datetime.now()

# 判断当天是否是工作日【正常周内、调休都是工作日】print(now_.strftime("%Y-%m-%d"), "是否是工作日:"

, is_workday(now_))

# 判断当天是否是节假日【正常周末、放假都是节假日】print(now_.strftime("%Y-%m-%d"), "是否是节假日:"

, is_holiday(now_))

# 判断指定日期是节假日还是工作日someday = datetime.date(2024210

)

print(someday.strftime("%Y-%m-%d"), "是否是工作日:"

, is_workday(someday))

print(someday.strftime("%Y-%m-%d"), "是否是节假日:"

, is_holiday(someday))

这个示例代码演示了如何使用Python的chinese_calendar模块来判断一个日期是否是法定节假日。你可以根据自己的需求修改日期来使用。

如何修改为SQL数据?

SQL是数据分析中常用的工具,于是乎,我将这些【节假日】、【调休日期】转化为sql语句,并保存到对应的sql文件中,具体代码如下:

import

 datetime

from chinese_calendar import

 is_holiday, is_workday

from chinese_calendar.constants import

 workdays, holidays

# 节假日的中英文名称

day_name_list = [

    ("New Years Day""元旦"1

),

    ("Spring Festival""春节"3

),

    ("Tomb-sweeping Day""清明"1

),

    ("Labour Day""劳动节"1

),

    ("Dragon Boat Festival""端午"1

),

    ("National Day""国庆节"3

),

    ("Mid-autumn Festival""中秋"1

)

]

# 制作节假日sql语句holidays_sql = """insert into holidays(holiday,english_name,chinese_name) values """for k, v in

 holidays.items():

    for h in

 day_name_list:

        if v == h[0

]:

            holidays_sql += str(tuple((k.strftime("%Y-%m-%d"), v.replace(""""), h[1]))) + ",\n"            continue# 替换最后一个逗号为分号holidays_sql = holidays_sql[:-2] + ";"with open("./holidays_value.sql""w", encoding="utf-8"as

 f:

    f.write(holidays_sql)

    print("holidays_sql写入文件holidays_value.sql成功!"

)

# 制作调休sql语句workdays_sql = """insert into workdays(workday,english_name,chinese_name) values """for k, v in

 workdays.items():

    for h in

 day_name_list:

        if v == h[0

]:

            workdays_sql += str(tuple((k.strftime("%Y-%m-%d"), v.replace(""""), h[1]))) + ",\n"            continue# 替换最后一个逗号为分号workdays_sql = workdays_sql[:-2] + ";"with open("./workdays_value.sql""w", encoding="utf-8"as

 f:

    f.write(workdays_sql)

    print("workdays_sql写入文件workdays_value.sql成功!"

)

节假日sql数据

节假日表【holidays】创建语句:

CREATE TABLE `holidays`

 (

  `holiday` varchar(100NOT NULL

,

  `english_name` varchar(100NOT NULL

,

  `chinese_name` varchar(100NOT NULL

,

  PRIMARY KEY (`holiday`

)

ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE

=utf8mb4_0900_ai_ci;

节假日数据sql语句:

insert into holidays(holiday,english_name,chinese_name) values (2004-01-01New Years Day元旦

),

(2004-01-22Spring Festival春节

),

(2004-01-23Spring Festival春节

),

(2004-01-24Spring Festival春节

),

(2004-01-25Spring Festival春节

),

(2004-01-26Spring Festival春节

),

(2004-01-27Spring Festival春节

),

(2004-01-28Spring Festival春节

),

(2004-05-01Labour Day劳动节

),

(2004-05-02Labour Day劳动节

),

(2004-05-03Labour Day劳动节

),

(2004-05-04Labour Day劳动节

),

(2004-05-05Labour Day劳动节

),

(2004-05-06Labour Day劳动节

),

(2004-05-07Labour Day劳动节

),

(2004-10-01National Day国庆节

),

(2004-10-02National Day国庆节

),

(2004-10-03National Day国庆节

),

(2004-10-04National Day国庆节

),

(2004-10-05National Day国庆节

),

(2004-10-06National Day国庆节

),

(2004-10-07National Day国庆节

),

(2005-01-01New Years Day元旦

),

(2005-01-02New Years Day元旦

),

(2005-01-03New Years Day元旦

),

(2005-02-09Spring Festival春节

),

(2005-02-10Spring Festival春节

),

(2005-02-11Spring Festival春节

),

(2005-02-12Spring Festival春节

),

(2005-02-13Spring Festival春节

),

(2005-02-14Spring Festival春节

),

(2005-02-15Spring Festival春节

),

(2005-05-01Labour Day劳动节

),

(2005-05-02Labour Day劳动节

),

(2005-05-03Labour Day劳动节

),

(2005-05-04Labour Day劳动节

),

(2005-05-05Labour Day劳动节

),

(2005-05-06Labour Day劳动节

),

(2005-05-07Labour Day劳动节

),

(2005-10-01National Day国庆节

),

(2005-10-02National Day国庆节

),

(2005-10-03National Day国庆节

),

(2005-10-04National Day国庆节

),

(2005-10-05National Day国庆节

),

(2005-10-06National Day国庆节

),

(2005-10-07National Day国庆节

),

(2006-01-01New Years Day元旦

),

(2006-01-02New Years Day元旦

),

(2006-01-03New Years Day元旦

),

(2006-01-29Spring Festival春节

),

(2006-01-30Spring Festival春节

),

(2006-01-31Spring Festival春节

),

(2006-02-01Spring Festival春节

),

(2006-02-02Spring Festival春节

),

(2006-02-03Spring Festival春节

),

(2006-02-04Spring Festival春节

),

(2006-05-01Labour Day劳动节

),

(2006-05-02Labour Day劳动节

),

(2006-05-03Labour Day劳动节

),

(2006-05-04Labour Day劳动节

),

(2006-05-05Labour Day劳动节

),

(2006-05-06Labour Day劳动节

),

(2006-05-07Labour Day劳动节

),

(2006-10-01National Day国庆节

),

(2006-10-02National Day国庆节

),

(2006-10-03National Day国庆节

),

(2006-10-04National Day国庆节

),

(2006-10-05National Day国庆节

),

(2006-10-06National Day国庆节

),

(2006-10-07National Day国庆节

),

(2007-01-01New Years Day元旦

),

(2007-01-02New Years Day元旦

),

(2007-01-03New Years Day元旦

),

(2007-02-18Spring Festival春节

),

(2007-02-19Spring Festival春节

),

(2007-02-20Spring Festival春节

),

(2007-02-21Spring Festival春节

),

(2007-02-22Spring Festival春节

),

(2007-02-23Spring Festival春节

),

(2007-02-24Spring Festival春节

),

(2007-05-01Labour Day劳动节

),

(2007-05-02Labour Day劳动节

),

(2007-05-03Labour Day劳动节

),

(2007-05-04Labour Day劳动节

),

(2007-05-05Labour Day劳动节

),

(2007-05-06Labour Day劳动节

),

(2007-05-07Labour Day劳动节

),

(2007-10-01National Day国庆节

),

(2007-10-02National Day国庆节

),

(2007-10-03National Day国庆节

),

(2007-10-04National Day国庆节

),

(2007-10-05National Day国庆节

),

(2007-10-06National Day国庆节

),

(2007-10-07National Day国庆节

),

(2007-12-30New Years Day元旦

),

(2007-12-31New Years Day元旦

),

(2008-01-01New Years Day元旦

),

(2008-02-06Spring Festival春节

),

(2008-02-07Spring Festival春节

),

(2008-02-08Spring Festival春节

),

(2008-02-09Spring Festival春节

),

(2008-02-10Spring Festival春节

),

(2008-02-11Spring Festival春节

),

(2008-02-12Spring Festival春节

),

(2008-04-04Tomb-sweeping Day清明

),

(2008-04-05Tomb-sweeping Day清明

),

(2008-04-06Tomb-sweeping Day清明

),

(2008-05-01Labour Day劳动节

),

(2008-05-02Labour Day劳动节

),

(2008-05-03Labour Day劳动节

),

(2008-06-07Dragon Boat Festival端午

),

(2008-06-08Dragon Boat Festival端午

),

(2008-06-09Dragon Boat Festival端午

),

(2008-09-13Mid-autumn Festival中秋

),

(2008-09-14Mid-autumn Festival中秋

),

(2008-09-15Mid-autumn Festival中秋

),

(2008-09-29National Day国庆节

),

(2008-09-30National Day国庆节

),

(2008-10-01National Day国庆节

),

(2008-10-02National Day国庆节

),

(2008-10-03National Day国庆节

),

(2008-10-04National Day国庆节

),

(2008-10-05National Day国庆节

),

(2009-01-01New Years Day元旦

),

(2009-01-02New Years Day元旦

),

(2009-01-03New Years Day元旦

),

(2009-01-25Spring Festival春节

),

(2009-01-26Spring Festival春节

),

(2009-01-27Spring Festival春节

),

(2009-01-28Spring Festival春节

),

(2009-01-29Spring Festival春节

),

(2009-01-30Spring Festival春节

),

(2009-01-31Spring Festival春节

),

(2009-04-04Tomb-sweeping Day清明

),

(2009-04-05Tomb-sweeping Day清明

),

(2009-04-06Tomb-sweeping Day清明

),

(2009-05-01Labour Day劳动节

),

(2009-05-02Labour Day劳动节

),

(2009-05-03Labour Day劳动节

),

(2009-05-28Dragon Boat Festival端午

),

(2009-05-29Dragon Boat Festival端午

),

(2009-05-30Dragon Boat Festival端午

),

(2009-10-01National Day国庆节

),

(2009-10-02National Day国庆节

),

(2009-10-03Mid-autumn Festival中秋

),

(2009-10-04National Day国庆节

),

(2009-10-05National Day国庆节

),

(2009-10-06National Day国庆节

),

(2009-10-07National Day国庆节

),

(2009-10-08National Day国庆节

),

(2010-01-01New Years Day元旦

),

(2010-01-02New Years Day元旦

),

(2010-01-03New Years Day元旦

),

(2010-02-13Spring Festival春节

),

(2010-02-14Spring Festival春节

),

(2010-02-15Spring Festival春节

),

(2010-02-16Spring Festival春节

),

(2010-02-17Spring Festival春节

),

(2010-02-18Spring Festival春节

),

(2010-02-19Spring Festival春节

),

(2010-04-03Tomb-sweeping Day清明

),

(2010-04-04Tomb-sweeping Day清明

),

(2010-04-05Tomb-sweeping Day清明

),

(2010-05-01Labour Day劳动节

),

(2010-05-02Labour Day劳动节

),

(2010-05-03Labour Day劳动节

),

(2010-06-14Dragon Boat Festival端午

),

(2010-06-15Dragon Boat Festival端午

),

(2010-06-16Dragon Boat Festival端午

),

(2010-09-22Mid-autumn Festival中秋

),

(2010-09-23Mid-autumn Festival中秋

),

(2010-09-24Mid-autumn Festival中秋

),

(2010-10-01National Day国庆节

),

(2010-10-02National Day国庆节

),

(2010-10-03National Day国庆节

),

(2010-10-04National Day国庆节

),

(2010-10-05National Day国庆节

),

(2010-10-06National Day国庆节

),

(2010-10-07National Day国庆节

),

(2011-01-01New Years Day元旦

),

(2011-01-02New Years Day元旦

),

(2011-01-03New Years Day元旦

),

(2011-02-02Spring Festival春节

),

(2011-02-03Spring Festival春节

),

(2011-02-04Spring Festival春节

),

(2011-02-05Spring Festival春节

),

(2011-02-06Spring Festival春节

),

(2011-02-07Spring Festival春节

),

(2011-02-08Spring Festival春节

),

(2011-04-03Tomb-sweeping Day清明

),

(2011-04-04Tomb-sweeping Day清明

),

(2011-04-05Tomb-sweeping Day清明

),

(2011-04-30Labour Day劳动节

),

(2011-05-01Labour Day劳动节

),

(2011-05-02Labour Day劳动节

),

(2011-06-04Dragon Boat Festival端午

),

(2011-06-06Dragon Boat Festival端午

),

(2011-09-10Mid-autumn Festival中秋

),

(2011-09-11Mid-autumn Festival中秋

),

(2011-09-12Mid-autumn Festival中秋

),

(2011-10-01National Day国庆节

),

(2011-10-02National Day国庆节

),

(2011-10-03National Day国庆节

),

(2011-10-04National Day国庆节

),

(2011-10-05National Day国庆节

),

(2011-10-06National Day国庆节

),

(2011-10-07National Day国庆节

),

(2012-01-01New Years Day元旦

),

(2012-01-02New Years Day元旦

),

(2012-01-03New Years Day元旦

),

(2012-01-22Spring Festival春节

),

(2012-01-23Spring Festival春节

),

(2012-01-24Spring Festival春节

),

(2012-01-25Spring Festival春节

),

(2012-01-26Spring Festival春节

),

(2012-01-27Spring Festival春节

),

(2012-01-28Spring Festival春节

),

(2012-04-02Tomb-sweeping Day清明

),

(2012-04-03Tomb-sweeping Day清明

),

(2012-04-04Tomb-sweeping Day清明

),

(2012-04-29Labour Day劳动节

),

(2012-04-30Labour Day劳动节

),

(2012-05-01Labour Day劳动节

),

(2012-06-22Dragon Boat Festival端午

),

(2012-06-24Dragon Boat Festival端午

),

(2012-09-30Mid-autumn Festival中秋

),

(2012-10-01National Day国庆节

),

(2012-10-02National Day国庆节

),

(2012-10-03National Day国庆节

),

(2012-10-04National Day国庆节

),

(2012-10-05National Day国庆节

),

(2012-10-06National Day国庆节

),

(2012-10-07National Day国庆节

),

(2013-01-01New Years Day元旦

),

(2013-01-02New Years Day元旦

),

(2013-01-03New Years Day元旦

),

(2013-02-09Spring Festival春节

),

(2013-02-10Spring Festival春节

),

(2013-02-11Spring Festival春节

),

(2013-02-12Spring Festival春节

),

(2013-02-13Spring Festival春节

),

(2013-02-14Spring Festival春节

),

(2013-02-15Spring Festival春节

),

(2013-04-04Tomb-sweeping Day清明

),

(2013-04-05Tomb-sweeping Day清明

),

(2013-04-06Tomb-sweeping Day清明

),

(2013-04-29Labour Day劳动节

),

(2013-04-30Labour Day劳动节

),

(2013-05-01Labour Day劳动节

),

(2013-06-10Dragon Boat Festival端午

),

(2013-06-11Dragon Boat Festival端午

),

(2013-06-12Dragon Boat Festival端午

),

(2013-09-19Mid-autumn Festival中秋

),

(2013-09-20Mid-autumn Festival中秋

),

(2013-09-21Mid-autumn Festival中秋

),

(2013-10-01National Day国庆节

),

(2013-10-02National Day国庆节

),

(2013-10-03National Day国庆节

),

(2013-10-04National Day国庆节

),

(2013-10-05National Day国庆节

),

(2013-10-06National Day国庆节

),

(2013-10-07National Day国庆节

),

(2014-01-01New Years Day元旦

),

(2014-01-31Spring Festival春节

),

(2014-02-01Spring Festival春节

),

(2014-02-02Spring Festival春节

),

(2014-02-03Spring Festival春节

),

(2014-02-04Spring Festival春节

),

(2014-02-05Spring Festival春节

),

(2014-02-06Spring Festival春节

),

(2014-04-05Tomb-sweeping Day清明

),

(2014-04-06Tomb-sweeping Day清明

),

(2014-04-07Tomb-sweeping Day清明

),

(2014-05-01Labour Day劳动节

),

(2014-05-02Labour Day劳动节

),

(2014-05-03Labour Day劳动节

),

(2014-06-02Dragon Boat Festival端午

),

(2014-09-08Mid-autumn Festival中秋

),

(2014-10-01National Day国庆节

),

(2014-10-02National Day国庆节

),

(2014-10-03National Day国庆节

),

(2014-10-04National Day国庆节

),

(2014-10-05National Day国庆节

),

(2014-10-06National Day国庆节

),

(2014-10-07National Day国庆节

),

(2015-01-01New Years Day元旦

),

(2015-01-02New Years Day元旦

),

(2015-01-03New Years Day元旦

),

(2015-02-18Spring Festival春节

),

(2015-02-19Spring Festival春节

),

(2015-02-20Spring Festival春节

),

(2015-02-21Spring Festival春节

),

(2015-02-22Spring Festival春节

),

(2015-02-23Spring Festival春节

),

(2015-02-24Spring Festival春节

),

(2015-04-05Tomb-sweeping Day清明

),

(2015-04-06Tomb-sweeping Day清明

),

(2015-05-01Labour Day劳动节

),

(2015-06-20Dragon Boat Festival端午

),

(2015-06-22Dragon Boat Festival端午

),

(2015-09-27Mid-autumn Festival中秋

),

(2015-10-01National Day国庆节

),

(2015-10-02National Day国庆节

),

(2015-10-03National Day国庆节

),

(2015-10-04National Day国庆节

),

(2015-10-05National Day国庆节

),

(2015-10-06National Day国庆节

),

(2015-10-07National Day国庆节

),

(2016-01-01New Years Day元旦

),

(2016-02-07Spring Festival春节

),

(2016-02-08Spring Festival春节

),

(2016-02-09Spring Festival春节

),

(2016-02-10Spring Festival春节

),

(2016-02-11Spring Festival春节

),

(2016-02-12Spring Festival春节

),

(2016-02-13Spring Festival春节

),

(2016-04-04Tomb-sweeping Day清明

),

(2016-05-01Labour Day劳动节

),

(2016-05-02Labour Day劳动节

),

(2016-06-09Dragon Boat Festival端午

),

(2016-06-10Dragon Boat Festival端午

),

(2016-06-11Dragon Boat Festival端午

),

(2016-09-15Mid-autumn Festival中秋

),

(2016-09-16Mid-autumn Festival中秋

),

(2016-09-17Mid-autumn Festival中秋

),

(2016-10-01National Day国庆节

),

(2016-10-02National Day国庆节

),

(2016-10-03National Day国庆节

),

(2016-10-04National Day国庆节

),

(2016-10-05National Day国庆节

),

(2016-10-06National Day国庆节

),

(2016-10-07National Day国庆节

),

(2017-01-01New Years Day元旦

),

(2017-01-02New Years Day元旦

),

(2017-01-27Spring Festival春节

),

(2017-01-28Spring Festival春节

),

(2017-01-29Spring Festival春节

),

(2017-01-30Spring Festival春节

),

(2017-01-31Spring Festival春节

),

(2017-02-01Spring Festival春节

),

(2017-02-02Spring Festival春节

),

(2017-04-02Tomb-sweeping Day清明

),

(2017-04-03Tomb-sweeping Day清明

),

(2017-04-04Tomb-sweeping Day清明

),

(2017-05-01Labour Day劳动节

),

(2017-05-28Dragon Boat Festival端午

),

(2017-05-29Dragon Boat Festival端午

),

(2017-05-30Dragon Boat Festival端午

),

(2017-10-01National Day国庆节

),

(2017-10-02National Day国庆节

),

(2017-10-03National Day国庆节

),

(2017-10-04Mid-autumn Festival中秋

),

(2017-10-05National Day国庆节

),

(2017-10-06National Day国庆节

),

(2017-10-07National Day国庆节

),

(2017-10-08National Day国庆节

),

(2018-01-01New Years Day元旦

),

(2018-02-15Spring Festival春节

),

(2018-02-16Spring Festival春节

),

(2018-02-17Spring Festival春节

),

(2018-02-18Spring Festival春节

),

(2018-02-19Spring Festival春节

),

(2018-02-20Spring Festival春节

),

(2018-02-21Spring Festival春节

),

(2018-04-05Tomb-sweeping Day清明

),

(2018-04-06Tomb-sweeping Day清明

),

(2018-04-07Tomb-sweeping Day清明

),

(2018-04-29Labour Day劳动节

),

(2018-04-30Labour Day劳动节

),

(2018-05-01Labour Day劳动节

),

(2018-06-18Dragon Boat Festival端午

),

(2018-09-24Mid-autumn Festival中秋

),

(2018-10-01National Day国庆节

),

(2018-10-02National Day国庆节

),

(2018-10-03National Day国庆节

),

(2018-10-04National Day国庆节

),

(2018-10-05National Day国庆节

),

(2018-10-06National Day国庆节

),

(2018-10-07National Day国庆节

),

(2018-12-30New Years Day元旦

),

(2018-12-31New Years Day元旦

),

(2019-01-01New Years Day元旦

),

(2019-02-04Spring Festival春节

),

(2019-02-05Spring Festival春节

),

(2019-02-06Spring Festival春节

),

(2019-02-07Spring Festival春节

),

(2019-02-08Spring Festival春节

),

(2019-02-09Spring Festival春节

),

(2019-02-10Spring Festival春节

),

(2019-04-05Tomb-sweeping Day清明

),

(2019-04-06Tomb-sweeping Day清明

),

(2019-04-07Tomb-sweeping Day清明

),

(2019-05-01Labour Day劳动节

),

(2019-05-02Labour Day劳动节

),

(2019-05-03Labour Day劳动节

),

(2019-05-04Labour Day劳动节

),

(2019-06-07Dragon Boat Festival端午

),

(2019-06-08Dragon Boat Festival端午

),

(2019-06-09Dragon Boat Festival端午

),

(2019-09-13Mid-autumn Festival中秋

),

(2019-09-14Mid-autumn Festival中秋

),

(2019-09-15Mid-autumn Festival中秋

),

(2019-10-01National Day国庆节

),

(2019-10-02National Day国庆节

),

(2019-10-03National Day国庆节

),

(2019-10-04National Day国庆节

),

(2019-10-05National Day国庆节

),

(2019-10-06National Day国庆节

),

(2019-10-07National Day国庆节

),

(2020-01-01New Years Day元旦

),

(2020-01-24Spring Festival春节

),

(2020-01-25Spring Festival春节

),

(2020-01-26Spring Festival春节

),

(2020-01-27Spring Festival春节

),

(2020-01-28Spring Festival春节

),

(2020-01-29Spring Festival春节

),

(2020-01-30Spring Festival春节

),

(2020-01-31Spring Festival春节

),

(2020-02-01Spring Festival春节

),

(2020-02-02Spring Festival春节

),

(2020-04-04Tomb-sweeping Day清明

),

(2020-04-05Tomb-sweeping Day清明

),

(2020-04-06Tomb-sweeping Day清明

),

(2020-05-01Labour Day劳动节

),

(2020-05-02Labour Day劳动节

),

(2020-05-03Labour Day劳动节

),

(2020-05-04Labour Day劳动节

),

(2020-05-05Labour Day劳动节

),

(2020-06-25Dragon Boat Festival端午

),

(2020-06-26Dragon Boat Festival端午

),

(2020-06-27Dragon Boat Festival端午

),

(2020-10-01National Day国庆节

),

(2020-10-02National Day国庆节

),

(2020-10-03National Day国庆节

),

(2020-10-04National Day国庆节

),

(2020-10-05National Day国庆节

),

(2020-10-06National Day国庆节

),

(2020-10-07National Day国庆节

),

(2020-10-08National Day国庆节

),

(2021-01-01New Years Day元旦

),

(2021-01-02New Years Day元旦

),

(2021-01-03New Years Day元旦

),

(2021-02-11Spring Festival春节

),

(2021-02-12Spring Festival春节

),

(2021-02-13Spring Festival春节

),

(2021-02-14Spring Festival春节

),

(2021-02-15Spring Festival春节

),

(2021-02-16Spring Festival春节

),

(2021-02-17Spring Festival春节

),

(2021-04-03Tomb-sweeping Day清明

),

(2021-04-04Tomb-sweeping Day清明

),

(2021-04-05Tomb-sweeping Day清明

),

(2021-05-01Labour Day劳动节

),

(2021-05-02Labour Day劳动节

),

(2021-05-03Labour Day劳动节

),

(2021-05-04Labour Day劳动节

),

(2021-05-05Labour Day劳动节

),

(2021-06-12Dragon Boat Festival端午

),

(2021-06-13Dragon Boat Festival端午

),

(2021-06-14Dragon Boat Festival端午

),

(2021-09-19Mid-autumn Festival中秋

),

(2021-09-20Mid-autumn Festival中秋

),

(2021-09-21Mid-autumn Festival中秋

),

(2021-10-01National Day国庆节

),

(2021-10-02National Day国庆节

),

(2021-10-03National Day国庆节

),

(2021-10-04National Day国庆节

),

(2021-10-05National Day国庆节

),

(2021-10-06National Day国庆节

),

(2021-10-07National Day国庆节

),

(2022-01-01New Years Day元旦

),

(2022-01-02New Years Day元旦

),

(2022-01-03New Years Day元旦

),

(2022-01-31Spring Festival春节

),

(2022-02-01Spring Festival春节

),

(2022-02-02Spring Festival春节

),

(2022-02-03Spring Festival春节

),

(2022-02-04Spring Festival春节

),

(2022-02-05Spring Festival春节

),

(2022-02-06Spring Festival春节

),

(2022-04-03Tomb-sweeping Day清明

),

(2022-04-04Tomb-sweeping Day清明

),

(2022-04-05Tomb-sweeping Day清明

),

(2022-04-30Labour Day劳动节

),

(2022-05-01Labour Day劳动节

),

(2022-05-02Labour Day劳动节

),

(2022-05-03Labour Day劳动节

),

(2022-05-04Labour Day劳动节

),

(2022-06-03Dragon Boat Festival端午

),

(2022-06-04Dragon Boat Festival端午

),

(2022-06-05Dragon Boat Festival端午

),

(2022-09-10Mid-autumn Festival中秋

),

(2022-09-11Mid-autumn Festival中秋

),

(2022-09-12Mid-autumn Festival中秋

),

(2022-10-01National Day国庆节

),

(2022-10-02National Day国庆节

),

(2022-10-03National Day国庆节

),

(2022-10-04National Day国庆节

),

(2022-10-05National Day国庆节

),

(2022-10-06National Day国庆节

),

(2022-10-07National Day国庆节

),

(2022-12-31New Years Day元旦

),

(2023-01-01New Years Day元旦

),

(2023-01-02New Years Day元旦

),

(2023-01-21Spring Festival春节

),

(2023-01-22Spring Festival春节

),

(2023-01-23Spring Festival春节

),

(2023-01-24Spring Festival春节

),

(2023-01-25Spring Festival春节

),

(2023-01-26Spring Festival春节

),

(2023-01-27Spring Festival春节

),

(2023-04-05Tomb-sweeping Day清明

),

(2023-04-29Labour Day劳动节

),

(2023-04-30Labour Day劳动节

),

(2023-05-01Labour Day劳动节

),

(2023-05-02Labour Day劳动节

),

(2023-05-03Labour Day劳动节

),

(2023-06-22Dragon Boat Festival端午

),

(2023-06-23Dragon Boat Festival端午

),

(2023-06-24Dragon Boat Festival端午

),

(2023-09-29Mid-autumn Festival中秋

),

(2023-09-30National Day国庆节

),

(2023-10-01National Day国庆节

),

(2023-10-02National Day国庆节

),

(2023-10-03National Day国庆节

),

(2023-10-04National Day国庆节

),

(2023-10-05National Day国庆节

),

(2023-10-06National Day国庆节

),

(2024-01-01New Years Day元旦

),

(2024-02-10Spring Festival春节

),

(2024-02-11Spring Festival春节

),

(2024-02-12Spring Festival春节

),

(2024-02-13Spring Festival春节

),

(2024-02-14Spring Festival春节

),

(2024-02-15Spring Festival春节

),

(2024-02-16Spring Festival春节

),

(2024-02-17Spring Festival春节

),

(2024-04-04Tomb-sweeping Day清明

),

(2024-04-05Tomb-sweeping Day清明

),

(2024-04-06Tomb-sweeping Day清明

),

(2024-05-01Labour Day劳动节

),

(2024-05-02Labour Day劳动节

),

(2024-05-03Labour Day劳动节

),

(2024-05-04Labour Day劳动节

),

(2024-05-05Labour Day劳动节

),

(2024-06-10Dragon Boat Festival端午

),

(2024-09-15Mid-autumn Festival中秋

),

(2024-09-16Mid-autumn Festival中秋

),

(2024-09-17Mid-autumn Festival中秋

),

(2024-10-01National Day国庆节

),

(2024-10-02National Day国庆节

),

(2024-10-03National Day国庆节

),

(2024-10-04National Day国庆节

),

(2024-10-05National Day国庆节

),

(2024-10-06National Day国庆节

),

(2024-10-07National Day国庆节

);

调休日sql数据

调休日表【weekdays】创建语句:

CREATE TABLE `workdays`

 (

  `workday` varchar(100NOT NULL

,

  `english_name` varchar(100NOT NULL

,

  `chinese_name` varchar(100NOT NULL

,

  PRIMARY KEY (`workday`

)

ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE

=utf8mb4_0900_ai_ci;

调休日sql语句:

insert into workdays(workday,english_name,chinese_name) values (2004-01-17Spring Festival春节

),

(2004-01-18Spring Festival春节

),

(2004-05-08Labour Day劳动节

),

(2004-05-09Labour Day劳动节

),

(2004-10-09National Day国庆节

),

(2004-10-10National Day国庆节

),

(2005-02-05Spring Festival春节

),

(2005-02-06Spring Festival春节

),

(2005-04-30Labour Day劳动节

),

(2005-05-08Labour Day劳动节

),

(2005-10-08National Day国庆节

),

(2005-10-09National Day国庆节

),

(2006-01-28Spring Festival春节

),

(2006-02-05Spring Festival春节

),

(2006-04-29Labour Day劳动节

),

(2006-04-30Labour Day劳动节

),

(2006-09-30National Day国庆节

),

(2006-10-08National Day国庆节

),

(2006-12-30New Years Day元旦

),

(2006-12-31New Years Day元旦

),

(2007-02-17Spring Festival春节

),

(2007-02-25Spring Festival春节

),

(2007-04-28Labour Day劳动节

),

(2007-04-29Labour Day劳动节

),

(2007-09-29National Day国庆节

),

(2007-09-30National Day国庆节

),

(2007-12-29New Years Day元旦

),

(2008-02-02Spring Festival春节

),

(2008-02-03Spring Festival春节

),

(2008-05-04Labour Day劳动节

),

(2008-09-27National Day国庆节

),

(2008-09-28National Day国庆节

),

(2009-01-04New Years Day元旦

),

(2009-01-24Spring Festival春节

),

(2009-02-01Spring Festival春节

),

(2009-05-31Dragon Boat Festival端午

),

(2009-09-27National Day国庆节

),

(2009-10-10National Day国庆节

),

(2010-02-20Spring Festival春节

),

(2010-02-21Spring Festival春节

),

(2010-06-12Dragon Boat Festival端午

),

(2010-06-13Dragon Boat Festival端午

),

(2010-09-19Mid-autumn Festival中秋

),

(2010-09-25Mid-autumn Festival中秋

),

(2010-09-26National Day国庆节

),

(2010-10-09National Day国庆节

),

(2011-01-30Spring Festival春节

),

(2011-02-12Spring Festival春节

),

(2011-04-02Tomb-sweeping Day清明

),

(2011-10-08National Day国庆节

),

(2011-10-09National Day国庆节

),

(2011-12-31New Years Day元旦

),

(2012-01-21Spring Festival春节

),

(2012-01-29Spring Festival春节

),

(2012-03-31Tomb-sweeping Day清明

),

(2012-04-01Tomb-sweeping Day清明

),

(2012-04-28Labour Day劳动节

),

(2012-09-29National Day国庆节

),

(2013-01-05New Years Day元旦

),

(2013-01-06New Years Day元旦

),

(2013-02-16Spring Festival春节

),

(2013-02-17Spring Festival春节

),

(2013-04-07Tomb-sweeping Day清明

),

(2013-04-27Labour Day劳动节

),

(2013-04-28Labour Day劳动节

),

(2013-06-08Dragon Boat Festival端午

),

(2013-06-09Dragon Boat Festival端午

),

(2013-09-22Mid-autumn Festival中秋

),

(2013-09-29National Day国庆节

),

(2013-10-12National Day国庆节

),

(2014-01-26Spring Festival春节

),

(2014-02-08Spring Festival春节

),

(2014-05-04Labour Day劳动节

),

(2014-09-28National Day国庆节

),

(2014-10-11National Day国庆节

),

(2015-01-04New Years Day元旦

),

(2015-02-15Spring Festival春节

),

(2015-02-28Spring Festival春节

),

(2015-10-10National Day国庆节

),

(2016-02-06Spring Festival春节

),

(2016-02-14Spring Festival春节

),

(2016-06-12Dragon Boat Festival端午

),

(2016-09-18Mid-autumn Festival中秋

),

(2016-10-08National Day国庆节

),

(2016-10-09National Day国庆节

),

(2017-01-22Spring Festival春节

),

(2017-02-04Spring Festival春节

),

(2017-04-01Tomb-sweeping Day清明

),

(2017-05-27Dragon Boat Festival端午

),

(2017-09-30National Day国庆节

),

(2018-02-11Spring Festival春节

),

(2018-02-24Spring Festival春节

),

(2018-04-08Tomb-sweeping Day清明

),

(2018-04-28Labour Day劳动节

),

(2018-09-29National Day国庆节

),

(2018-09-30National Day国庆节

),

(2018-12-29New Years Day元旦

),

(2019-02-02Spring Festival春节

),

(2019-02-03Spring Festival春节

),

(2019-04-28Labour Day劳动节

),

(2019-05-05Labour Day劳动节

),

(2019-09-29National Day国庆节

),

(2019-10-12National Day国庆节

),

(2020-01-19Spring Festival春节

),

(2020-04-26Labour Day劳动节

),

(2020-05-09Labour Day劳动节

),

(2020-06-28Dragon Boat Festival端午

),

(2020-09-27National Day国庆节

),

(2020-10-10National Day国庆节

),

(2021-02-07Spring Festival春节

),

(2021-02-20Spring Festival春节

),

(2021-04-25Labour Day劳动节

),

(2021-05-08Labour Day劳动节

),

(2021-09-18Mid-autumn Festival中秋

),

(2021-09-26National Day国庆节

),

(2021-10-09National Day国庆节

),

(2022-01-29Spring Festival春节

),

(2022-01-30Spring Festival春节

),

(2022-04-02Tomb-sweeping Day清明

),

(2022-04-24Labour Day劳动节

),

(2022-05-07Labour Day劳动节

),

(2022-10-08National Day国庆节

),

(2022-10-09National Day国庆节

),

(2023-01-28Spring Festival春节

),

(2023-01-29Spring Festival春节

),

(2023-04-23Labour Day劳动节

),

(2023-05-06Labour Day劳动节

),

(2023-06-25Dragon Boat Festival端午

),

(2023-10-07National Day国庆节

),

(2023-10-08National Day国庆节

),

(2024-02-04Spring Festival春节

),

(2024-02-18Spring Festival春节

),

(2024-04-07Tomb-sweeping Day清明

),

(2024-04-28Labour Day劳动节

),

(2024-05-11Labour Day劳动节

),

(2024-09-14Mid-autumn Festival中秋

),

(2024-09-29National Day国庆节

),

(2024-10-12National Day国庆节

);

福利领取

关注微信公众号 「帅帅的Python」后台回复 「JR」 领取节假日SQL数据文件,回复 「FL」 领取电子书和学习视频。

在线咨询

点击这里给我发消息售前咨询专员

点击这里给我发消息售后服务专员

在线咨询

免费通话

24h咨询:400-888-8888


如您有问题,可以咨询我们的24H咨询电话!

免费通话

微信扫一扫

微信联系
返回顶部