Improve algorithm setDateFomat