I wrote the following function to convert the current WordPress date format into a format that can be recognized by the jQuery UI Datepicker:
From: http://codex.wordpress.org/Formatting_Date_and_Time
To: http://docs.jquery.com/UI/Datepicker/formatDate
/**
* Convert a date format to a jQuery UI DatePicker format
*
* @param string $dateFormat a date format
* @return string
*/
function dateFormatTojQueryUIDatePickerFormat($dateFormat) {
$chars = array(
// Day
'd' => 'dd', 'j' => 'd', 'l' => 'DD', 'D' => 'D',
// Month
'm' => 'mm', 'n' => 'm', 'F' => 'MM', 'M' => 'M',
// Year
'Y' => 'yy', 'y' => 'y',
);
return strtr((string)$dateFormat, $chars);
}
Anyone know of any easier/built-in way to accomplish this?