Refactor getting date function.
Fix code according Iterator description.