<?php 
$html='';
        $html.='<div
                class=" input-append input-prepend date dateTimePicker navbar-search"
                id="datetimepicker" 
            >';        
	  $html.='<span class="add-on"><i class="icon-arrow-left" onclick="prevDay()"></i></span>';
	  $html.= CHtml::textField('StatisticDay',date(phpUserDatePattern()), array(
            
            'size'=>60,
            'maxlength'=>256,
            'readonly'=>'readonly',
            'disabled' => 'disabled',
            'class'=>'span2'
        ));

        $html.='<span class="add-on"><i class="icon-th"></i></span>';
        $html.='<span class="add-on"><i class="icon-arrow-right" onclick="nextDay()"></i></span>';
        $html.='</div>';

      echo $html;
	
      $dataUrl =  url('analyticsDailyReport/default/createReport',$_GET);
?>
<script>
var startDate = null;
var pattern = '<?php echo DTPUserDatePattern() ?>';

var dailyOptions = {
    minView:2,
    todayBtn:true,
    pickerPosition:'bottom-left',
    showMeridian:false,
    endDate: new Date(),
    startView:2,
    date: startDate,
    format: pattern,
    autoclose:true,
    forceParse:false
}

$('.dateTimePicker').datetimepicker(dailyOptions)

$('#StatisticDay').on('change',function(ev) {  
      changeDate();
      updateDiagram();
});
function nextDay() {

var splitedGermanDate = $('#StatisticDay').val().split('.');
  var parsedDate = '';
  if (splitedGermanDate.length == 3 ) {

     parsedDate = parseGermanDateToServerFormat(splitedGermanDate);
  } else {
    parsedDate = splitedGermanDate[0];
  }

  $('.dateTimePicker').datetimepicker('setDate',new Date(new Date(parsedDate).getTime() + (24 * 60 * 60 * 1000)));
  $('#StatisticDay').trigger('change');
}
function prevDay() {
  var splitedGermanDate = $('#StatisticDay').val().split('.');
  var parsedDate = '';
  if (splitedGermanDate.length == 3 ) {

     parsedDate = parseGermanDateToServerFormat(splitedGermanDate);
  } else {
    parsedDate = splitedGermanDate[0];
  }
  $('.dateTimePicker').datetimepicker('setDate',new Date(new Date(parsedDate).getTime() - (24 * 60 * 60 * 1000)));
  $('#StatisticDay').trigger('change');
}

function parseGermanDateToServerFormat(data) {
    var year    = data[2];
    var month   = data[1];
    var day     = data[0];
    var parsedDate = year+'-'+month+'-'+day;
    console.log(parsedDate);
    return parsedDate;
}
</script>