format_timestamp: I can't format to readable view
I want to format dates (created_at) to readable view.
1. I use Loop
2. I use format_timestamp
But the result contains dates in timestamp fromat not readable
Result in Debugger:
What do I do wrong?
Best Answer
-
Hello there,
Xano stores timestamps as a Unix timestamp in milliseconds in the database. You may use the format_timestamp filter in Xano to convert these Unix timestamps into a human-readable format based on the supplied format, however, it will still continue to be Unix timestamp in the database.This can be particularly useful when you want to display dates and times in a specific format on the frontend that doesn't support a custom format.
You are manipulating the data in your for each loop but returning the query from the database. That's why it is showing as UNIX in your response statement.
I've recreated your scenario and added two more functions that will help you accomplish what you want. See the image below.
Let me know if it helped you get where you wanted.
Answers
-
Thanks a lot! Perfect!
I'm gonna try tomorrow
-
Louis Machado - CSA
I have solved my problem easier.
On step 2 (applying format_timestamp) I replace model.created_at on item.created_at both in
EXISTING VARIABLE and VALUE . That was all. I didn't need to create new var and array.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback