added extract date function