dprc88435 2016-07-26 10:17
浏览 18

如何在蛋糕php中添加datepicker

this solvedd my inserting data into input field but now i want to insert time stamp by not using the inputfield

<?php echo $this->Form->input("date", array('label' => "Date : ", 'type' => 'text', 'class' => 'fl tal vat w300p', 'error' => false , 'id' => 'select_date')); ?>
<?php echo $this->Html->div('datepicker_img w100p fl pl460p pa', $this->Html->image('calendar.png'),array('id' => 'datepicker_img')); ?>
<?php echo $this->Html->div('datepicker fl pl460p pa', ' ' ,array('id' => 'datepicker')); ?>

I have used the above code for date picker, now i want the timestamp to use in my cakephp.

Sometimes it storing the exact timestamp and some times it is not storing it just using '0000-00-00 00:00:00.000000' value in the database.

if there is any code can any one please help me with the code thanks in advance!

  • 写回答

1条回答 默认 最新

  • duangang79177 2016-07-27 10:07
    关注

    Please add this script in your view

    <script>
    
        $(function() {
            $( "#YourTableNameYourField").datepicker({
                dateFormat: "yy-mm-dd",
                changeMonth: true,
                changeYear: true,
                yearRange:"-100:+50"
            });
    
        });
        </script>
    

    And your input will be same as

    <?php echo $this->Form->create('YourTableName' , array('action'=>'YourAction') );?>
        <?php echo $this->Form->input('YourField',array('label'=>false,'div'=>false,'class'=>'form-control','required'=>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)