added function for lastdate and weekdays