# Sort by timestamp not working correctly

**URL:** <https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913>\
**Category:** Report a Bug\
**Created:** [October 5, 2019, 5:32pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913 "2019-10-05T17:32:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![apertur.co](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@apertur.co](https://community.glideapps.com/u/apertur.co)\
**Post date:** [October 5, 2019, 5:32pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/1 "2019-10-05T17:32:39Z")

</div>

My app’s URL: [https://aperturomc-demo.glideapp.io](https://aperturomc-demo.glideapp.io).

My app creates a list of posts created by users. Each post is time-stamped, and they are sorted Z-\>A by timestamp. Old posts sort correctly, but when a user adds new posts, they are put at the bottom of the list, although they are then sorted correctly among themselves.

“Reverse list” works correctly, so I will use that going forward. For now, I am keeping the timestamp sort until you can look into it.

---

<div class="post-metadata">

**Author:** ![George\_B](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george_b/32/534_2.png) [@George\_B](https://community.glideapps.com/u/George_B)\
**Post date:** [October 5, 2019, 6:35pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/2 "2019-10-05T18:35:49Z")

</div>

Very interesting app. But by looking at the app I can’t see or understand what your issue is. When you say “they are sorted Z-\>A by timestamp” Where is this sort taking place? Is it a formula in the spreadsheet?

---

<div class="post-metadata">

**Author:** ![yinon\_raviv](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/yinon_raviv/32/1627_2.png) [@yinon\_raviv](https://community.glideapps.com/u/yinon_raviv)\
**Post date:** [October 5, 2019, 6:55pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/3 "2019-10-05T18:55:29Z")

</div>

Your app look great.  
How did you include the bullets and bold? Did you do in the sheet or used HTML formatting?  
Also, how did you include table in the score tab?  
Very interesting built 👌

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [October 5, 2019, 6:55pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/4 "2019-10-05T18:55:32Z")

</div>

Here are a couple threads that might help explain what’s happening. You are attempting to sort a timestamp, but that’s not how glide sees. Even though it’s mostly numbers, it’s till just text to glide. Sorts happen left to right, so no matter what, 1 comes before 2. Doesn’t matter if it’s a month, day, or year. It’s just sorting by individual character by character. The reverse order may be working for now, but remember that we just went from September (9) to October (10). Glide is comparing the 1 and the 9 first.

> [@Multiple Sorts with Date](https://community.glideapps.com/t/multiple-sorts-with-date/446/3):
>
> How is your date formatted in your extra column? Only YYYYMMDD is going to work properly. I think it’s Text(%date%, YYYYMMDD) You also need to pad spaces so each column, concated together, has a consistent width.

> [@Sort Inline list by number value](https://community.glideapps.com/t/sort-inline-list-by-number-value/807):
>
> Currently, the “Sort” function in Inline list sorts by alphanumeric list, and there is no option to sort via numbers. For example, this list: 3 5 2 1 14 24 Will be sorted as: 1 14 2 24 3 5 But, I would like the option to sort via numbers, so it will look like this: 1 2 3 5 14 24

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [October 5, 2019, 6:58pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/5 "2019-10-05T18:58:34Z")

</div>

Same methods that are described in your other thread. Markdown and the Rich Text component.

> [@How to include images horizontaly](https://community.glideapps.com/t/how-to-include-images-horizontaly/868):
>
> Hi all, Need your experts insights. Is there a way to put 2 or 3 (small) images next to each other in 1 row. For example, let’s say I want to put icons of mail, WhatsApp and call that each of them will be clickable to the relevant action. Thanks for any advice! Yinon

---

<div class="post-metadata">

**Author:** ![yinon\_raviv](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/yinon_raviv/32/1627_2.png) [@yinon\_raviv](https://community.glideapps.com/u/yinon_raviv)\
**Post date:** [October 5, 2019, 7:00pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/6 "2019-10-05T19:00:19Z")

</div>

The way to solve it will be to add a new column in you sheet the will present the timestamp as number (every date is actually a number in Google sheets) and to have the blogs sort by this column as z-a.  
Hope this works 😊

---

<div class="post-metadata">

**Author:** ![Michael\_Thomas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michael_thomas/32/82_2.png) [@Michael\_Thomas](https://community.glideapps.com/u/Michael_Thomas)\
**Post date:** [October 5, 2019, 10:41pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/7 "2019-10-05T22:41:43Z")

</div>

1. The only solution I know of is to create a helper column in Sheets that is sorted the way you want and in Glide sort by the helper column. I have currency columns (P2) that I had to create a help column formatt like this - =text(P2,“000000”). You may need to use a little different formatting for a date field, but you get the idea.

2. off-topic: in your App how did you display the Leader Board under “Score Card”? Is that a Sheet Chart?

---

<div class="post-metadata">

**Author:** ![apertur.co](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@apertur.co](https://community.glideapps.com/u/apertur.co)\
**Post date:** [October 5, 2019, 10:59pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/8 "2019-10-05T22:59:00Z")

</div>

I created cells in the spreadsheet that generate Markdown-compatible text. I followed the examples posted else where in the forum, plus a lot of trial-and-error. Below are some samples from my app’s **Scorecard** (the length of the table is dynamic and tied to the number of users of the app).

_Table heading_

```
=ArrayFormula(" | &nbsp;" & R1 & "&nbsp; | " & S1 & " | &nbsp;" & T1 & "&nbsp; | &nbsp;" & U1 & "&nbsp; |" & CHAR(10) & "| :---: | :--- | :---: | :---: |") & CHAR(10)

```

_Table rows_

```
=arrayformula(if($L$2:$L<>""," | " & R2:R & " | " & if(LEN(S2:S)<=14, S2:S, LEFT(S2:S, 14) & "…") & " | " & fixed(T2:T*100,0)&"%" & if($Q$2:$Q=1,"*","") & " | " & fixed(U2:U*100,0)&"%" & if($K$2:$K=1,"*","")& " | " & CHAR(10),""))

```

_Heading + rows + bottom note_

```
=V1 & concatenate(V2:V) & "|&nbsp;|&nbsp;|&nbsp;|&nbsp;|" & CHAR(10) & "| | *Activity count goal* |" &"*"&Team!$AE$1&"*"& "|" &"*"&Team!$AE$1*Team!$W$1&"*"& "|"
```

---

<div class="post-metadata">

**Author:** ![apertur.co](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@apertur.co](https://community.glideapps.com/u/apertur.co)\
**Post date:** [October 5, 2019, 11:01pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/9 "2019-10-05T23:01:51Z")

</div>

This explains it. The built-in “reverse order” is suitable for what I need. Thanks for your help!

---

<div class="post-metadata">

**Author:** ![Paul\_Hartweck](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paul_hartweck/32/1224_2.png) [@Paul\_Hartweck](https://community.glideapps.com/u/Paul_Hartweck)\
**Post date:** [October 30, 2019, 7:27pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/10 "2019-10-30T19:27:18Z")

</div>

How did you get the timestamp to “stamp” with new entries?  
I’m attempting to timestamp when an entry is changed.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [October 30, 2019, 7:48pm UTC](https://community.glideapps.com/t/sort-by-timestamp-not-working-correctly/913/11 "2019-10-30T19:48:01Z")

</div>

Use the Date/Time Special Value component and point it to your date column in your sheet.
