How to detect if "Show end date" is checked?
It's stored against the field settings in the field_config table. You can get access to it through the API with field_info_field()

$field_info = field_info_field('field_name');
$to_date_setting = $field_info['settings']['todate']; // optional, required, etc