# Using sortOn with date objects

**URL:** <https://forum.kirupa.com/t/using-sorton-with-date-objects/234385>\
**Category:** flash\
**Created:** [August 1, 2007, 7:26pm UTC](https://forum.kirupa.com/t/using-sorton-with-date-objects/234385 "2007-08-01T19:26:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robx2](https://avatars.discourse-cdn.com/v4/letter/r/b5e925/32.png) [@robx2](https://forum.kirupa.com/u/robx2)\
**Post date:** [August 1, 2007, 7:26pm UTC](https://forum.kirupa.com/t/using-sorton-with-date-objects/234385/1 "2007-08-01T19:26:59Z")

</div>

I have a multidimensional array where the items have Date objects. I 've tried to use Array.sortOn(myDate) with no success. Do I have to convert the Date to a string (like 20070731) to use sortOn correctly? What’s best practice for sortingOn by date?

Thanks.
