Php 验证开始日期应小于Yii中的结束日期

Php 验证开始日期应小于Yii中的结束日期,php,validation,date,yii,Php,Validation,Date,Yii,我的表(在其他列中)有开始日期和结束日期。我需要验证Yii中的开始日期是否小于结束日期 我验证了吗?在模型的rules()方法中使用for: array( 'event_end_date', 'compare', 'compareAttribute'=>'event_start_date', 'operator'=>'>', 'allowEmpty'=>false , 'message'=>'{attribute} must be gre

我的表(在其他列中)有开始日期和结束日期。我需要验证Yii中的开始日期是否小于结束日期

我验证了吗?

在模型的rules()方法中使用for:

array(
  'event_end_date',
  'compare',
  'compareAttribute'=>'event_start_date',
  'operator'=>'>', 
  'allowEmpty'=>false , 
  'message'=>'{attribute} must be greater than "{compareValue}".'
),

我用了这个,它很管用。谢谢阿尤什。@siddharth:除了谢谢之外,我可能会感激的。不仅是我,还有任何人。。仅当答案有效时才执行。还可以使用
{compareAttribute}
来显示比较属性的标签,而不是值。我有同样的问题,这回答了它。谢谢阿尤什。