Set value for start/end date field labels in hook_form_alter how can I replace the labels of start/end date for a date field via form_alter? the code below only works for the fieldset. The "to" needs to be removed.

$form['field_my_dates']['und']['0']['#title'] = t('My new title');




Code below not working neither, please help me to figure out how to do it! I forgot to mention that I'm using the popup widget for the date field.

function mywebform_date_combo_process_alter(&amp;$element, &amp;$form_state, &amp;$context) {
    if ($element['#field_name'] == 'field_my_dates') {
        $element['value']['#date_title'] = 'From';
        $element['value2']['#date_title'] = 'To';
        $element['value2']['#title'] = t('');
    }
}

function mywebform_date_part_label_date($vars) {
    if ('field_my_dates' == $vars['element']['#field']['field_name']) {
        return t($vars['element']['#date_title']);
    } else {return t('Date');}
}
Something similar to below might help,change combo field title from 'to:' to none:

function mymodulename_date_combo_process_alter(&amp;$element, &amp;$form_state, &amp;$context) {
    $element['value2']['#title'] = t('');
}


To change From and To date field labels,implement

function mymodule_date_part_label_date(&amp;$vars) {
    if ($vars['element']['#field']['field_name'] == 'yourfield_machine_name') {
      if ($vars['element']['#date_title'] == 'Date Start date') {
        return t('Date (From:)');
      } elseif ($vars['element']['#date_title'] == 'Date End date') {
          return t('Date (To:)');
        }
    } else {
        return t($vars['element']['#date_title']);
    }
}