# Wie kann mann nach Feldtype "Date" sortieren?

**URL:** <https://discourse.getcockpit.com/t/wie-kann-mann-nach-feldtype-date-sortieren/1301>\
**Category:** Support\
**Created:** [March 27, 2020, 11:59am UTC](https://discourse.getcockpit.com/t/wie-kann-mann-nach-feldtype-date-sortieren/1301 "2020-03-27T11:59:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![StasSav](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/stassav/32/476_2.png) [@StasSav](https://discourse.getcockpit.com/u/StasSav)\
**Post date:** [March 27, 2020, 11:59am UTC](https://discourse.getcockpit.com/t/wie-kann-mann-nach-feldtype-date-sortieren/1301/1 "2020-03-27T11:59:57Z")

</div>

wie kann mann nach Feldtype “Date” in eine API anfrage sortieren?  
z.b.: ich habe so ein Formatierung “format”: “DD MMMM YYYY”

---

<div class="post-metadata">

**Author:** ![StasSav](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/stassav/32/476_2.png) [@StasSav](https://discourse.getcockpit.com/u/StasSav)\
**Post date:** [March 27, 2020, 12:29pm UTC](https://discourse.getcockpit.com/t/wie-kann-mann-nach-feldtype-date-sortieren/1301/2 "2020-03-27T12:29:45Z")

</div>

gefunden )))

```
news.sort(function(a, b) {
   a.Datum = Number(new Date(a.Datum));
   b.Datum = Number(new Date(b.Datum));
   return b.Datum - a.Datum;
});
```

---

<div class="post-metadata">

**Author:** ![serjoscha87](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/serjoscha87/32/151_2.png) [@serjoscha87](https://discourse.getcockpit.com/u/serjoscha87)\
**Post date:** [March 29, 2020, 12:56pm UTC](https://discourse.getcockpit.com/t/wie-kann-mann-nach-feldtype-date-sortieren/1301/3 "2020-03-29T12:56:57Z")

</div>

you can even do this directly using an additional parameter in your cockpit-api-query:

`/api/collections/get/YOURCOLLECTION?sort[date]=-1&token=...`

**possible parameter vals for sort** : -1 | 1 | \<_unset_\>
