format_timestamp: I can't format to readable view

Options
gymeney
gymeney Member
edited October 2023 in ? Working with APIs

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

  • Louis Machado - CSA
    Louis Machado - CSA Administrator

    ADMIN

    Answer ✓
    Options

    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