Time Couting

hi i need to limite date select in datepicker(withn 30day)

i mean

[b]Example :-[/b]

this is offer create table i want to add date limitation becouse offer publish withn month

when some select 1 September, 2013 in from row in form , he/she only can select date among 30 September, 2013

when some select 10 September, 2013 in from row in form , he/she only can select date among 09 October , 2013

my data table

CREATE TABLE IF NOT EXISTS offer_detail (

id int(60) NOT NULL AUTO_INCREMENT,

company_id int(60) NOT NULL,

offertype_id int(60) NOT NULL,

category_id int(60) NOT NULL,

offer_title varchar(150) NOT NULL,

offer_description text NOT NULL,

image varchar(150) NOT NULL,

coupon_id varchar(60) NOT NULL,

price text NOT NULL,

unit_id varchar(60) NOT NULL,

price_now varchar(60) NOT NULL,

[color="#FF0000"][b]from varchar(80) NOT NULL,

to varchar(80) NOT NULL,[/b][/color]

user_id int(10) NOT NULL,

created varchar(11) NOT NULL,

modified varchar(10) NOT NULL,

Active varchar(100) NOT NULL,

PRIMARY KEY (id),

KEY company_id (company_id,category_id,coupon_id,unit_id),

KEY category_id (category_id,coupon_id,unit_id),

KEY coupon_id (coupon_id),

KEY unit_id (unit_id),

KEY offertype_id (offertype_id),

KEY user_id (user_id,Active)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT

this my view code about above row(which i highlight)

<b><?php echo $form->labelEx($model,‘from’); ?></b>

<?php

$this->widget(‘zii.widgets.jui.CJuiDatePicker’,

array(

'attribute'=&gt;'from',


'model'=&gt;&#036;model,


'options' =&gt; array(


                  'mode'=&gt;'focus',


                  'dateFormat'=&gt;'d MM, yy',


                  'showAnim' =&gt; 'slideDown',


                  ),


'htmlOptions'=&gt;array('size'=&gt;20,'class'=&gt;'', 'value'=&gt;date(&quot;d F, Y&quot;)),

)

);

?>

<?php echo $form->error($model,‘from’); ?>

<b><?php echo $form->labelEx($model,‘to’); ?></b>

<?php

$this->widget(‘zii.widgets.jui.CJuiDatePicker’,

array(

'attribute'=&gt;'to',


'model'=&gt;&#036;model,


'options' =&gt; array(


                  'mode'=&gt;'focus',


                  'dateFormat'=&gt;'d MM, yy',


                  'showAnim' =&gt; 'slideDown',


                  ),


'htmlOptions'=&gt;array('size'=&gt;20,'class'=&gt;'', 'value'=&gt;date(&quot;d F, Y&quot;)),

)

);

?>

<?php echo $form->error($model,‘to’); ?>

this screen shot about my view form

check this forum

i hope it’s some help.

You can force user to select the date only in the certain range

CJuiDatePicker is not haveing this feature

you can have look on this jquery date picker

http://jqueryui.com/datepicker/

code sample




 <script>

  		              $(document).ready(function(){

  		                 var date1 = new Date("<?php echo $created_date;?>");

                       date1 .setMonth(date1 .getMonth() + <?php echo $addmonth;?>);

                       $("#<?php echo 'peroidfrom_'.$incidentid;?>").datepicker(

                      	       { dateFormat: 'dd/mm/yy',

                      			    minDate:new Date("<?php echo $created_date;?>"),

                      	            maxDate: date1,

                      			    showOn: 'button',

                      			    buttonImage: '<?php echo Yii::app()->request->baseUrl;?>/images/calender.png',

                      			    buttonImageOnly: true,

                      			    hideIfNoPrevNext: true

                      			 }

                      	     );

                      	     

                          });

		               </script>



also see this

http://yiibook.blogspot.in/2012/05/date-picker-in-yii.html#Yii-CJuiDatePicker-Date-Range

thnaks maggi …i got nice solution

thank everyone

regard

channasmcs)

(Relax, its only ONES and ZEROS!)