<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: 'table information', iconCls: 'icon-OK ', width: 800, height: 400, pageSize: 10, pageList: [5, 10, 15, 20], nowrap: true, // set to true. When the data length exceeds the column width, the striped: true is automatically truncated. // if it is set to true, the row background is displayed alternately. Collapsible: true, // display the foldable button toolbar: "# tb", url: 'Load! QueryTable. action? Begindate = & enddate = & username = & ip = & operate = ', loadMsg: 'loading data ...... ', singleSelect: true, // only one row can be selected fitColumns: true, // allow automatic table scaling to adapt to the parent container remoteSort: false, frozenColumns: [[{field: 'ck ', checkbox: true}], columns: [{title: 'title', field: 'title', width: '2013', rowspan: 2, align: 'center'}, {title: 'type', field: 'cpertype', width: '000000', rowspan: 2, align: 'center'}, {title: 'upload time', field: 'loadtime', width: '000000', rowspan: 2, align: 'center', formatter: function (val) {/* Call function display time */return formattime (val) ;}}], pagination: true, // pagination rownumbers: true // number of rows });});
var mytime; $('#time2').datetimebox();
Var row = $ ('# tt '). datagrid ('getselected'); mytime = formattime (row. loadtime);/* loadtime is the time field in the database */totime (mytime);/* call the totime Method */
function totime(val){ $('#time2').datetimebox('setValue',val); }
<Tr> <td> upload time </td> <input name = "time2" id = "time2"> </td> </tr>