# Sort datatable ascending

**URL:** <https://forum.uipath.com/t/sort-datatable-ascending/348689>\
**Category:** Activities\
**Tags:** studio, system, activities\
**Created:** [September 27, 2021, 1:32pm UTC](https://forum.uipath.com/t/sort-datatable-ascending/348689 "2021-09-27T13:32:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheetal\_Bora](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sheetal_bora/32/186045_2.png) [@sheetal\_Bora](https://forum.uipath.com/u/sheetal_Bora)\
**Post date:** [September 27, 2021, 1:32pm UTC](https://forum.uipath.com/t/sort-datatable-ascending/348689/1 "2021-09-27T13:32:21Z")

</div>

Have a datatable with column created date all dates in table are in string format, req is to sort the table with created date in ascending order.oldest created date shall be at top!  
Tia

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [September 27, 2021, 1:41pm UTC](https://forum.uipath.com/t/sort-datatable-ascending/348689/2 "2021-09-27T13:41:42Z")

</div>

Hi,

If your date format is like “MM/dd/yyyy” style for example, the following will work.

```
dt = dt.AsEnumerable.OrderBy(Function(r) DateTime.Parse(r("DateColumn").ToString)).CopyToDataTable()

```

If it throws Invalid string exception, we need to use ParseExact method.

Regards,

---

<div class="post-metadata">

**Author:** ![sheetal\_Bora](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sheetal_bora/32/186045_2.png) [@sheetal\_Bora](https://forum.uipath.com/u/sheetal_Bora)\
**Post date:** [September 27, 2021, 2:41pm UTC](https://forum.uipath.com/t/sort-datatable-ascending/348689/3 "2021-09-27T14:41:39Z")

</div>

Can we update data type of a column created date to datetime at a shot?

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [September 27, 2021, 10:52pm UTC](https://forum.uipath.com/t/sort-datatable-ascending/348689/4 "2021-09-27T22:52:53Z")

</div>

Hi,

> [@sheetal\_Bora](#):
>
> Can we update data type of a column created date to datetime at a shot?

Do you mean to want to change column data type from String to DateTime? If so,ee need to create new DateTime type column then convert and set all the data to it. ( and remove old column if necessary)

Regards,

---

<div class="post-metadata">

**Author:** ![sheetal\_Bora](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sheetal_bora/32/186045_2.png) [@sheetal\_Bora](https://forum.uipath.com/u/sheetal_Bora)\
**Post date:** [September 28, 2021, 7:18am UTC](https://forum.uipath.com/t/sort-datatable-ascending/348689/5 "2021-09-28T07:18:36Z")

</div>

Yeah
