■ timedelta 함수를 사용해 날짜에 시간 더하기

------------------------------------------------------------------------------------------------------------------------

import datetime

 

def AddHours(sourceDate, count):

    targetDate = sourceDate + datetime.timedelta(hours = count)

    return targetDate

 

if __name__ == "__main__":

    sourceDate = datetime.datetime.now()

    targetDate = AddHours(sourceDate, 10)

    print(sourceDate)

    print(targetDate)

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요