skyxing7
    def is_today(target_date):
        """
        2020-03-25 17:03:55
        Detects if the date is current date
        :param target_date:
        :return: Boolean
        """
        # Get the year, month and day
        c_year = datetime.datetime.now().year
        c_month = datetime.datetime.now().month
        c_day = datetime.datetime.now().day

        # Disassemble the date
        date_list = target_date.split(" ")[0].split("-")
        t_year = int(date_list[0])
        t_month = int(date_list[1])
        t_day = int(date_list[2])

        final = False
        # Compare years, months and days
        if c_year == t_year and c_month == t_month and c_day == t_day:
            final = True

        return final

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2021-11-28
  • 2021-11-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
  • 2021-12-03
  • 2021-12-16
  • 2021-10-25
  • 2021-07-20
相关资源
相似解决方案