I use this for the form field:
echo 'Set next action date: <input type="text" id="next_action" name="next_action" value="' . $next_action . '" />';
In the scipt setting for datepicker, I enable this option:
dateFormat: 'yy-mm-dd',
This gives me the correct MySQL date format for inserting / updating in a table. But it is not very friendly to visitors, so I set my preferred format at the top of the page:
if ($s['next_action'] >= "1") { $next_action = date($date_style,strtotime($s['next_action'])); } else { $next_action = ''; }
It depends on the variable in my main include file:
$date_style = "F d, Y";
If I select a date, datepicker gives me a good date for the database on submit, although it shows the format yyyy-mm-dd until it is sent. After sending it uses a nice display.
Van
source share