POC : Tamil Date parser using parse
15 November 2024 at 18:05
Tamil Date time parser POC
https://github.com/r1chardj0n3s/parse
it requires external dependency parse for parsing the python string format with placeholders
import parse
from date import TA_MONTHS
from date import datetime
//POC of tamil date time parser
def strptime(format='{month}, {date} {year}',date_string ="เฎจเฎตเฎฎเฏเฎชเฎฐเฏ, 16 2024"):
parsed = parse.parse(format,date_string)
month = TA_MONTHS.index(parsed['month'])+1
date = int(parsed['date'])
year = int(parsed['year'])
return datetime(year,month,date)
print(strptime("{date}-{month}-{year}","16-เฎจเฎตเฎฎเฏเฎชเฎฐเฏ-2024"))
#dt = datetime(2024,11,16);
# print(dt.strptime_ta("เฎจเฎตเฎฎเฏเฎชเฎฐเฏ , 16 2024","%m %d %Y"))