Updated function for parse string date to date