Skip to content

Instantly share code, notes, and snippets.

@hugodotlau
Created June 6, 2012 07:20
Show Gist options
  • Save hugodotlau/2880403 to your computer and use it in GitHub Desktop.
Save hugodotlau/2880403 to your computer and use it in GitHub Desktop.
Datetime comparing when validating a Yii form
<?php
public function rules()
{
return array(
array(
'end_time',
'compare',
'compareAttribute'=>'start_time',
'operator'=>'>',
'on'=>'insert',
'message'=>'Ending time should be greater than starting time'
),
);
}
@hugodotlau
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment