将日期从JSON转换为数据表

时间:2018-08-10 04:14:50

标签: php jquery json sql-server

"tgl_dok":{"date":"2018-07-02 00:00:00.000000","timezone_type":3,"timezone":"Europe\/Berlin"}

jQuery代码

$(document).ready(function(){
  $('#table').DataTable({
    "paging": true,
    "lengthChange": true,
    "searching": false,
    "ordering": true,
    "info": false,
    "responsive": true,
    "autoWidth": false,
    "pageLength": 10,
    "ajax": {
      "url": "../adapter/ArReport/rptPenerimaanHarian/data.php",
      type: "POST",
      data: ({kd_entitas: kd_entitas,
        tglAwal: tglAwal,
        tglAkhir: tglAkhir})
    },
    "columns": [
    {
      title: 'Date',
      data: "tgl_dok",
      "type": "date", 
    },
    {
      title: 'Receipt. No',
      data: "no_dok"
    },
    ]
  })
});

如何在DD/MM/YY中显示类似datatables的日期格式?

1 个答案:

答案 0 :(得分:0)

UPDATE MyTable SET MyDate = CONVERT(datetime, '2018-07-02 00:00:00.000000', 121)

关于转换规则的外观here