java - How to check and parse different date styles -
i getting date of birth data table oracle column type varchar2
instead of date
main reason data parsed cv parsing company because different cvs has various style of date of birth like:
3-3-1986 11.04.1983 07/24/1969 december, 05, 1986 november 03, 1981 october 06,1973 may 18th, 1984 jan. 27th, 1967 nov. 18, 1976 july 3,1989 27/02/1978 place of birthlisbon, portugal june,11,1979
here method far have written:
public int getage(string dob){ int age = 0; if(dob==null || dob.equals("")){ age = 0; } else{ dob = dob.trim(); string[] words = dob.split ("-|/"); string day = words[0]; string month = words[1]; string year = words[2]; age = calculateage.agecalculator(day, month, year); } return age; }
but in method able deal slashes , dash. please me sort out how can day, month , year accurately aforementioned samples of dates.
you cannot.
parsing string in conceivable format impossible.
take 1 of examples: 11.04.1983
is april 11th or november 4th? there no way know.
the best can extract year when see four-digit year, , perhaps judge day-of-month when greater 12.
by way, seems odd tracking birth dates , going trouble calculate age of job applicants. age makes poor criterion job qualification. , doing illegal in many places.
Comments
Post a Comment