jquery - PHP strtotime not being executed at all within Joomla Component -
i building custom component within joomla takes values input input form , wraps them in order sent off in soap request. 1 of input form elements date (date of birth, or it's name in form "dob") needs converted valid date format soap api accept.
i having strange issue within function accepts , prepares these form elements sent whereas php function strtotime doesn't seem working @ when attempt change date format valid format soap api handle.
here relevant function code deals time formatting post element dob:
$postvar['dob'] = date("y-d-m g-i-s", strtotime($_post['dob'])); die(print_r($postvar['dob']));
when die , print variable shown above see result is, strtotime ignored , doesn't die.
the form uses jquery datepicker date form element , here variable output $_post['dob'] looks when recieved function.
14/03/2013
can see why strtotime function not having effect here , being ignored? thanks
edit: add here jquery datepicker code if of help.
jquery("#dob").datepicker({dateformat:'dd/mm/yy', changemonth: true, stepmonths: 12, showanim:"slidedown" });
in joomla!, never touch of superglobals directly. also, check results get, if may reflect error condition.
$input = jfactory::getapplication()->input; $dob = $input->get('dob', null, 'string'); $postvar['dob'] = 'invalid'; if (!is_null($dob)) { $dob = strtotime($dob); if ($dob > 0) { $postvar['dob'] = date("y-d-m g-i-s", $dob); } }
Comments
Post a Comment