# \[Bug-2737\] Perspective table - sorting date column

**URL:** <https://forum.inductiveautomation.com/t/bug-2737-perspective-table-sorting-date-column/31213>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 10, 2020, 2:58pm UTC](https://forum.inductiveautomation.com/t/bug-2737-perspective-table-sorting-date-column/31213 "2020-01-10T14:58:25Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [February 12, 2021, 7:10pm UTC](https://forum.inductiveautomation.com/t/bug-2737-perspective-table-sorting-date-column/31213/9 "2021-02-12T19:10:13Z")

</div>

In the long run, we used something similar to this as a transform on our dataset binding, so the table is pre-sorted by dates:

```auto
def sort_dataset_by_date(dset, date_column, ascending=True):
	orig_columns = system.dataset.getColumnHeaders(dset)
	tstamps = [system.date.toMillis(x) for x in dset.getColumnAsList(date_column)]
	dset = system.dataset.addColumn(dset, 0, tstamps, 'tmp_tstamp', long)
	dset = system.dataset.sort(dset, 0, ascending)
	return system.dataset.filterColumns(dset, orig_columns)

```

If you’re using this for a table component, you can leave the `tmp_stamp` column in place and just not display it.

---

_[View the full topic](https://forum.inductiveautomation.com/t/bug-2737-perspective-table-sorting-date-column/31213)._
