import re import datetime def DateCHToUS(date): #01.02.2010 --> 2010-02-01 day="" month="" year="" for i in range(0,1+1): day+= date[i] for i in range(3,4+1): month+=date[i] for i in range(6,9+1): year+=date[i]; newdate = year+"-"+month+"-"+day return(newdate) def indeed_date(date): redate = re.match('\d+',date) fixdate = today().strftime("%Y/%m%d") - timedelta(days=redate.group()) print("date: today") return fixdate