Easyui擷取資料庫date資料的顯示

來源:互聯網
上載者:User

<script type="text/javascript">function formattime(val) {var year=parseInt(val.year)+1900;var month=(parseInt(val.month)+1);month=month>9?month:('0'+month);var date=parseInt(val.date);date=date>9?date:('0'+date);var hours=parseInt(val.hours);hours=hours>9?hours:('0'+hours);var minutes=parseInt(val.minutes);minutes=minutes>9?minutes:('0'+minutes);var seconds=parseInt(val.seconds);seconds=seconds>9?seconds:('0'+seconds);var time=year+'-'+month+'-'+date+' '+hours+':'+minutes+':'+seconds;    return time;}</script>

$(function() {  $('#tt').datagrid({title : '表格資訊',iconCls : 'icon-ok',width : 800,height : 400,pageSize : 10,pageList : [ 5, 10, 15, 20 ],nowrap : true,//設定為true,當資料長度超出列寬時將會自動截取striped : true,//設定為true將交替顯示行背景。collapsible : true,//顯示可摺疊按鈕toolbar : "#tb",url : 'load!queryTable.action?begindate=&enddate=&username=&ip=&operate=',loadMsg : '資料裝載中......',singleSelect : true,//只能選擇單行fitColumns : true,//允許表格自動縮放,以適應父容器remoteSort : false,frozenColumns : [ [ {field : 'ck',checkbox : true} ] ],columns : [ [ {title : '標題',field : 'title',width : '340',rowspan : 2,align : 'center'},{title : '類型',field : 'cpersontype',width : '120',rowspan : 2,align : 'center'},{title : '上傳時間',field : 'loadtime',width : '120',rowspan : 2,align : 'center',formatter:function(val){ /* 調用函數顯示時間 */return formattime(val);}}] ],pagination : true,//分頁rownumbers : true//行數});});


var mytime;  $('#time2').datetimebox();


var row=$('#tt').datagrid('getSelected');mytime=formattime(row.loadtime);/*loadtime是資料庫中時間的欄位*/totime(mytime);/*調用totime方法*/


function totime(val){    $('#time2').datetimebox('setValue',val);    }

      <tr>      <td>上傳時間</td>      <td><input  name="time2" id="time2"  > </td>     </tr>


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.