8

I don't understand the difference between ascending and descending? Surely ascending means the most active/recent/popular/A first, and descending means the least active/recent/popular/Z first?

But it seems it's the reverse in most API routes. (I think there are a few where it's different but I always find it hard to get my head around asc vs desc)

EG: http://api.stackoverflow.com/1.1/tags?order=desc&sort=name brings up results that start with Z

but: when using descending with date/activity sorted routes the most recent/active items are shown.

0

1 Answer 1

16

Dates increase as time advances, so 1293861600 (Jan. 1st 2011) is greater than 946706400 (Jan 1st. 2000). Thus, a descending ordering puts the most recent dates first.

Because sorting by dates is much more common than by name, ordering is descending by default.

5
  • Surely ascending means, as you go up the list the value gets greater? It doesn't say this in /usage Commented Mar 21, 2011 at 7:33
  • @Jonathan - that is what ascending means, and that's why the most recent dates are returned first in when order=desc; since they are larger than dates in the past. Commented Mar 21, 2011 at 15:49
  • ok I've just never understood ascending and descending I find they are uselessly indiscriptive and kind of generic. I'll just have to take 15 minutes to learn them. Commented Mar 21, 2011 at 15:57
  • I know I'm late, but I'll point out for the alphabet: think of it in ASCII (Unicode) numbering. Z is highest in number, while A is lowest in number. So a descending alphabet starts at Z and ends at A. Commented Mar 24, 2014 at 19:02
  • 1
    @Jonathan. I know this explanation sounds a bit 'Peter & Jane', but the way I visualise this, is: I am at the bottom of the stairs. The first stair is stair number 1 and the second stair is stair number 2 etc. As I "ascend", the stair number increases, so I am going from the lowest numbered to the highest numbered stair. And dates are actually just numbers [seconds actually from 1970]. So with date order=asc, means that you see the least recent [lowest number] dates first & date order=desc, means that you see the most recent [highest number] dates first! Commented Oct 29, 2017 at 16:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.