Updated getDate function.