refactor to use to_date method