I see that CDateTimeParser has option for:
MMM | Short textual representation of month, three letters
But no option to enter long month name
How can we make it accept long month names?
I see that CDateTimeParser has option for:
MMM | Short textual representation of month, three letters
But no option to enter long month name
How can we make it accept long month names?
Surprisingly, the parser doesn’t seem to support that, judging by the source code. I’d recommend putting in a feature request, but for now you could try PHP’s built in strtotime() function:
http://www.php.net/manual/en/function.strtotime.php
If you need more control over the format, PHP has a multitude of date related functions that you can use:
Cheers Keith. If anyone is interested the code for this is as follows:
public function longMonthFormat($attribute, $params)
{
if($this->$attribute != date('d F Y', strtotime($this->$attribute)))
{
$this->addError($attribute, 'The format of '. $this->getAttributeLabel($attribute).' is invalid.');
}
}
Also looks like the option is going to be added in the next release: https://github.com/yiisoft/yii/issues/1282