relation_to_base_date function