method for parsing date and/or time strings