python 获取当前时间和日期

    技术2023-11-09  76

    python 获取当前时间和日期

    import time def get_now_time():     """     获取当前日期时间     :return:当前日期时间     """     now =  time.localtime()     now_time = time.strftime("%Y-%m-%d %H:%M:%S", now)     # now_time = time.strftime("%Y-%m-%d ", now)     return now_time if __name__ == '__main__':     now_time = get_now_time()     print(now_time)
    Processed: 0.016, SQL: 10