Date with leading zero

I would like to see Date values with leading zero.
Out of the box, AppSheet shows a date value like this: 1.1.2022
But I want it like this: 01.01.2022

So I made a VC with type Text and the expression:
TEXT([Date],"DD.MM.YYYY")

This is perfect. But when I sort the table by this VC, the sort order gets bad.

Sort by [Date]
3X_f_b_fb208d1df13131c0a0ac029d48da963eb2dbd84d.png

Sort by [DateVC]
3X_d_1_d19ec53023c003c67db7dc42cbc12e71cac43152.png

Des anyone know a workaround?

0 14 895
14 REPLIES 14

Hello, so looking at this the reason why the โ€œSort by [DateVC]โ€ is giving you an odd order is because we as people look at this and see a date. However appsheet is looking at this and seeing it as a text. So this is in order of the numbers descending. What I recommend is make two columns one of them would be a column that you would show. [DateVC] in your UX views anytime you display the date use that one. Then I would make the [Date] the one appsheet understands in any formula or sorting.

So [DateVC] anytime you want to display the date in your app.
[Date] in a format you do not want to see can be used only in formulas because it keeps the data type of date.

I think that should resolve your problem but please let me know if I can be of anymore help.

Craig
QREW Technologies

Pls check if this is useful

Final solution i found was to change the Language Setting in Android to English UK

I faced the same issue. My workaround was to start with the year as in: yyyy:mm:dd.

Having a two-digit display was a user request. When I turned the date around, he didnโ€™t even notice and was happy with it.

Hi @Fabian
I just can confirm basically what others have said.
The format without zeros depends on your locale config so we canโ€™t change the standars.
You found the great TEXT() expression to be quite good at displaying it the way you want, but itโ€™s just text now.
I use the YYYY/MM/DD technick when I need a string of text to be interpreted from old to new since it will work almost on every place you can imagine.
For example, I always save files and create them using YYYY-MM-DD at the begining because I can then sort by name on my files explorer. Since the created/modified date could change or lost (itโ€™s just metadata) the name works best for me

Thank you all for the good input.
I will go with TEXT([Date],"YYYY-MM-DD")

That is a good choice. I also approve of ISO date format YYYY-MM-DD.

I was able to do sort with Date Type that too dd-mm-yyyy format itself without going for TEXT() after implementing the setting change in android as i mentioned above.

in this if i click the date header it sorts according to date.

Thank you for this update @jyothis.m but asking the customer to change itโ€™s language settings in android is sometimes too much

Fully agree on that. Just posted it in case if its useful.

Steve
Platinum 4
Platinum 4

Why?

all your values in the column would be the same width then

Not unless you use a fixed-width font, too.

I should have said: My customer wants to see Date values with leading zero. Itโ€™s about aesthetics.

I thought it would be as easy as you can set it up in Google Sheets.
3X_4_5_45ea6499a661797766f299923f755c1b4e18f1ec.png

Top Labels in this Space