小编nei*_*sor的帖子

数据表 - 如何按日期排序 (dd.mm.yyyy)

我有一个包含多列的表。1 列包含格式为 dd.mm.yyyy 的日期(例如:2021 年 5 月 26 日)。我正在尝试实现按日期默认排序。

我的桌子看起来像这样:

<table id="myTable" class="table table-striped table-hover" style="width:100%">
            <thead>
                <tr>
                    <th>Title</th>
                    <th>Date</th>
                    <th>Time</th>
                    <th>Notes</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Some Text.</td>
                    <td>25.06.2021</td> <!-- This is the date column I want to sort by -->
                    <td>15:10</td>
                    <td>Some Text 2</td>
                </tr>
                <tr>
                    <td>Some Text</td>
                    <td>22.07.2020</td> <!-- This is the date column I want to sort by -->
                    <td>16:00</td>
                    <td>Some Text XYZ</td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <th>Title</th>
                    <th>Date</th>
                    <th>Time</th>
                    <th>Notes</th>
                </tr>
            </tfoot>
        </table>
Run Code Online (Sandbox Code Playgroud)

<body>到目前为止,我的 HTML …

javascript datatable date datatables

3
推荐指数
1
解决办法
7863
查看次数

标签 统计

datatable ×1

datatables ×1

date ×1

javascript ×1