def get_new_set_time(seconds_added = 60):
"""
-Helper function used in order to create
an assignment that will be due very soon (late assignmnet)
-Should be a very easy process for most cases, but deals with all the
difficulties for you
-The new time computed is calculated from the local time
Uses datetime.datetime
:param seconds_added: number of seconds from
now that you want the due date of the assignment to be
:return:
string of format HHMMpm/am which you can enter directly into the due time
textbox in order to set the due time
"""
# get current time and time at which to make it due
time_now = datetime.now()
time_now = time_now + timedelta(seconds=seconds_added)
time_string = str(time_now.hour) + str(time_now.minute)
time_structure = datetime.strptime(time_string,"%H%M")
# time_structure is a datetime.datetime object
time_string_reform = time_structure.strftime("%I%M%p")
# ^ set_time comes in format "HH MM am/pm"
return time_string_reform
################
test_start_late_homework_student.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录