Getting a date field and picker working in Joomla 1.6+ PDF Print E-mail
Tuesday, 31 January 2012 00:00

Despite much searching on the web and on the Joomla forums, I was only slightly the wiser. Some experimentation inspired by what I read, however, allowed me to get it working:-

// output our date field and picker
$date_format_string='%Y-%m-%d'; // default YYYY-MM-DD
if ($date_format=='1') { // DD-MM-YYYY
$date_format_string='%d-%m-%Y';
$tmp2=explode('-', $enddate);
$enddate=$tmp2[2] . '-' . $tmp2[1] . '-' . $tmp2[0];
}
if ($date_format=='2') { // MM-DD-YYYY
$date_format_string='%m-%d-%Y';
$tmp2=explode('-', $enddate);
$enddate=$tmp2[1] . '-' . $tmp2[2] . '-' . $tmp2[0];
}
echo JHTML::_( 'calendar', "$enddate", "enddate", "enddate", $date_format_string, ' size="10" maxlength="10" title="Click on the icon to choose a date" READONLY ');

Last Updated on Friday, 10 February 2012 10:40