Tell me why the result of executing such code: 10
import datetime def get_days_passed(date_string): input_date = datetime.datetime( int(date_string[:4]), int(date_string[5:7]), int(date_string[8:10]) ) return (datetime.datetime.today()-input_date).days if __name__ == '__main__': print(get_days_passed('2018-01-12')) # output: 10 And the result of this is 0:
def get_days_passed(date_string): input_date = datetime.datetime.strptime(date_string, '%Y-%m-%d') return (datetime.datetime.today()-input_date).days if __name__ == '__main__': print(get_days_passed('2018-01-12')) # output: 0 
datetime.datetime.strptime('2018-01-12', '%Y-%m-%d')- MaxUdate_string[9:10]- will return4- that's the whole secret ... - MaxU