job-scrapper/lib/dateconverter.py
ccppi 42d11c1c8d added indeed suport
start extracting date from "vor X days" where time = today-X
2024-07-23 14:55:37 +02:00

24 lines
499 B
Python

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