job-scrapper/lib/dateconverter.py

24 lines
499 B
Python
Raw Normal View History

import re
import datetime
2024-06-13 09:14:04 +00:00
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