This commit is contained in:
fengbohan 2025-04-06 17:38:47 +08:00
parent ccbd60cf58
commit 95fab6ac26
3 changed files with 26 additions and 2 deletions

View File

@ -1,4 +1,4 @@
user_name: 冯博涵
project_name: [nb2337,nb2353]
project_leader: [罗伟,何进]
project_name: [nb2426]
project_leader: [李夏禹]
template_file_name: 2017WWXX周工作报告样本.doc

15
time.py Normal file
View File

@ -0,0 +1,15 @@
from datetime import datetime, timedelta
def hours_until_5_20():
now = datetime.now()
target_time = datetime(now.year, now.month, now.day, 17, 20) # 设置目标时间为当天的17:20
#if now > target_time: # 如果当前时间已经过了今天的目标时间
# target_time += timedelta(days=1) # 将目标时间设置为明天的同一时间
time_difference = now -target_time
hours_difference = time_difference.total_seconds() / 3600 # 将时间差转换为小时
return hours_difference
# 调用函数并打印结果
print("Time until 5:20 is: {0:.2f} h".format(hours_until_5_20()))

9
week.py Normal file
View File

@ -0,0 +1,9 @@
import datetime
# 获取当前日期时间
now = datetime.datetime.now()
# 使用 isocalendar() 获取当前周数
week_number = now.isocalendar()[1]
print(f"当前是第 {week_number}")