English translation: As an experienced website operations expert, I know that every detail can affect user experience.In AnQi CMS, displaying the publish time of the comment list in a clear and easy-to-understand manner not only enhances the user experience but also makes the website content look more timely and professional.stampToDateTags make the publication time of each comment clear at a glance.


精细化管理时间呈现:安企CMS评论列表中如何利用stampToDate显示发布时间

In the era where content is king, the interactivity of a website is the key to attracting and retaining users.The comments section, as an important platform for user communication, directly affects the enthusiasm of users participating in it.Auto CMS is an efficient and flexible content management system that provides powerful template customization capabilities.Among them, a seemingly minor feature that can greatly enhance user experience is to convert the original timestamp format of comments' publishing time into the date and time format that we are accustomed to in daily life.stampToDate标签的用武之地。

KnowstampToDate:时间格式化的魔法师

In the template system of Anqi CMS,stampToDateis a very practical built-in tag, which is specifically used to convert the Unix timestamp (usually 10 digits) stored in the database into a date and time string that is easy for us to read. Imagine if the comment time displayed was1678886400, Common users can hardly understand what it represents at what time. And throughstampToDateWe can convert it to a clear and concise format such as '2023/03/15 10:00:00'.

The usage of this tag is very intuitive:{{stampToDate(时间戳, "格式")}}.

Among them,时间戳That is the 10-digit number we need to convert.格式It is a string that defines the appearance you want the time to ultimately present. It is especially important to note that the Anqi CMS'sstampToDateLabel supports the time format string, which follows the Go language's time formatting conventions. This means you need to use a special "reference time" -2006-01-02 15:04:05English version: To construct the format you want.

举例来说:

  • If you want to display “year-month-date”:"2006-01-02"
  • If you want to display “year/month/date”:"2006/01/02"
  • if you want to display “year after year”