0

I can't display the default value of the $date_debut in form. Dpm shows me that the right values are there and I can display $date_debut in #title but not on #default_value. any idea why ?

$timestamp_debut = variable_get('variable_1');
$date_debut = date('d-m-Y',$timestamp_debut);
$form['definition_de_la_période_de_modification']['date_de_debut'] = array(
  '#type' => 'date_popup',
  '#date_format' => 'd-m-Y',
  '#title' => t('Date de début'),
  '#default_value' => $date_debut,
  '#required' => FALSE,
);
2
  • Try using 'Y-m-d' as the date format (and changing $date_debut to match)
    – Clive
    Commented Apr 18, 2013 at 9:52
  • it works, thanks. what I wanted is the 'd-m-Y' so I changed code like that : $date_debut = date('Y-m-d',$timestamp_debut); and format = '#date_format' => 'd-m-Y
    – Tibi
    Commented Apr 18, 2013 at 12:35

0

Browse other questions tagged or ask your own question.