Requirement: I want to integrate my blog with the typecho backend and create a functionality for online status updates. I will input the content in typecho and then call an API to display the status updates on my blog. It may sound a bit complicated, but I think it's worth trying.
By default, the data exported from typecho is in timestamp format, which makes it inconvenient for frontend calls. Therefore, I chose to convert it directly in the SQL query. "created" is a parameter in the table.
// Conversion statement for time
FROM_UNIXTIME(created)
// Database query statement
$sql = "select FROM_UNIXTIME(created),text from ... order by created desc";
The exported data looks like this.
So, I will customize the previous statement using the "as" parameter.
$sql = "select FROM_UNIXTIME(created) as created,text from ... order by created desc";
The successful export makes the subsequent calls much simpler.
Thanks to 梦繁星 for the guidance.