Add extractDate function