Form : Date From Jquery Calendar

HI , in my db i have a date s’ field , i want take the date from a jquery calendar. The code is autogenerated from gii

I have 2 questions :

1 : How must i modificate the code to take date from calendar?

This is the date’s field :




<div class="row">

				<?php echo $form->labelEx($model,'data'); ?>

				<?php echo $form->textField($model,'data'); ?>

				<?php echo $form->error($model,'data'); ?>

			</div>



This is the jquery calendar:




<!-- Calendario Jquery -->

	<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">

	<script src="//code.jquery.com/jquery-1.9.1.js"></script>

	<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>


	 <script>

		$(function() {

		$( "#datepicker" ).datepicker();

		});

	</script>


	<p>Date: <input type="text" id="datepicker"></p>


	<!--  Fine Calendario Jquery -->




2- The Date taken by jquery calendar is in italian format dd/mm/yyyy in the db de date’s fields is in the Uk format yyyy/mm/gg,

out of framework , with the function substring i invert the format and insert it in db , How can i do this in the framework?

Tanks

It’s correct change this code :




<div class="row">

				

				<?php echo $form->labelEx($model,'data'); ?>

				<?php echo $form->textField($model,'data'); ?>

				<?phh echo $form->error($model,'data'); ?>

			</div>



with this?




<div class="row">

				<p style="color:green;">Data Uscita:<span style="color:red;">*</span></p>

				<input type="text" id="data">

				

			</div>