How to use Anqi CMS tags and filters to format date and timestamp display?

Calendar 👁️ 83

The timeliness and readability of website content largely depend on the accuracy and beauty of date and time information.AnQi CMS is an efficient content management system that provides flexible tags and filters to help us easily implement personalized date and time stamp displays, making your website content more closely aligned with user habits and enhancing the overall reading experience.This article will delve into how to skillfully use these features in Anqi CMS to convert original time data into a clear and understandable display format.

Understanding date and time data in AnQi CMS

In AnQi CMS, the creation time of documents (CreatedTime)、Update Time(UpdatedTime) and such time information are usually displayed asUnix timestampStored in the form of a format in the database. This numeric format is convenient for internal processing and storage within the system, but when displayed on the front end, we need to convert it to a date and time format that users are accustomed to, such as "2023 October 26 10:30:00".

Core tool:stampToDateTag

AnQi CMS provides special formatting for timestampstampToDateLabel, it is simple and intuitive, powerful, and the preferred choice for handling timestamp display.

The basic usage is:{{stampToDate(时间戳, "格式")}}.

  • timestampIt refers to a 10-digit Unix timestamp, for example.1609470335. This is the information you obtained from various tags (such asarchiveDetail/archiveList) obtained.CreatedTimeorUpdatedTimefrom the values of these fields.
  • FormatThis isstampToDateThe most flexible part of the label. It follows the unique time formatting rules of the Go language. Unlike the commonYYYY-MM-DDpattern, the Go language uses a fixed reference time -“January 2, 2006, 3:04:05 PM -0700 MST”Define the format. Just use the corresponding number or English word in this reference time to represent the year, month, day, hour, minute, and second you want.

For example:

  • Display "Year-Month-Day", the format string is"2006-01-02".
  • Display "Year/Month/Day Time:Minute", the format string is"2006/01/02 15:04".
  • Display "Month-Day Time:Minute", the format string is"01-02 15:04".
  • Would like to display "English month abbreviation Day, Year", the format string is"Jan 02, 2006".

**stampToDate

Related articles

How to display related recommended documents on the document detail page of AnQi CMS and customize the recommendation logic?

After visitors have read an interesting document or viewed a product introduction on your website, if they can get more relevant recommendations in a timely manner, it will undoubtedly greatly enhance their visit experience, extend their stay time, and encourage them to explore more corners of the website.AnQi CMS knows this and provides flexible and diverse features to help you cleverly display related recommendations on the document detail page, and can customize the recommendation logic according to your operational strategy. We will delve into how to implement this feature in Anqi CMS in detail.###

2025-11-09

How to display the links and titles of the previous and next documents in AnQi CMS?

How to easily display the link and title of the previous and next document in AnQi CMS?When browsing website articles, we often hope to smoothly jump from the current content to the previous or next related article. This seamless reading experience not only enhances user satisfaction but also has a positive effect on the overall structure of the website's content and SEO optimization.AnQi CMS is well-versed in this, providing content operators with an extremely convenient way to deploy such navigation functions with its flexible and powerful template engine.

2025-11-09

How to display filter conditions on the document list page of Anqi CMS and dynamically update results based on parameters?

In AnQi CMS, adding filtering conditions to the document list page and dynamically updating the results based on user selection is an important aspect of improving the discoverability and user experience of website content.This not only helps visitors quickly locate the content they are interested in, but also has a positive impact on SEO through a clear URL structure.Let's understand step by step how to implement this feature in Anqi CMS. ### Core Function: Content Model and Custom Fields are Basic Everything in Anqi CMS is built based on the "Content Model". The filtering function on the document list page

2025-11-09

How to display dynamic breadcrumb navigation and customize its display in Anqi CMS?

When we browse websites, we often see a line at the top or bottom of the page indicating the current navigation path, which is what we usually call 'Breadcrumbs'.It can not only clearly tell the user the position of the current page in the website structure, but also effectively improve the user experience and search engine optimization (SEO) effect of the website.AnQiCMS (AnQiCMS) is a powerful content management system that comes with a convenient way to generate and customize this dynamic breadcrumb navigation.

2025-11-09

How to display the friend link list in Anqi CMS and distinguish the rel="nofollow" attribute?

Friendship links play an important role in website operation, they not only help to increase the number of external links on the website, but also have a positive impact on search engine optimization (SEO), and can also provide users with more related resource entries.However, not all friendship links are suitable for passing weight or obtaining search engines' 'recommendations', at this point the `rel="nofollow"` attribute is particularly important.AnQiCMS (AnQiCMS) is a powerful content management system that fully considers the needs of website operators and provides a convenient link management function

2025-11-09

How to configure and display the site name, Logo, and filing information for Anqi CMS website?

The identity of a website often starts with its site name, logo, and filing information.In AnqiCMS, configuring and displaying these core information is the first step in building a website and is also a crucial step.The entire process is intuitive and convenient, even if you are a beginner using AnqiCMS, you can easily complete it.Next, we will introduce how to complete these settings in AnqiCMS and display them on your website.--- ### **First Step: Configure the website's basic information** First

2025-11-09

How to safely render HTML content generated by a rich text editor in the Anqi CMS template?

When building a website, a rich text editor (Rich Text Editor, abbreviated as RTE) is undoubtedly a powerful tool for content creation. It allows operators to edit content in a visual way, easily adding formats, images, links, and even tables, greatly enhancing the richness of content presentation.However, when this HTML content generated by RTE needs to be displayed in the front-end template of the website, how to ensure its safe rendering while retaining the expected style and structure is a problem that requires careful consideration.

2025-11-09

How to implement lazy loading of images and automatically convert them to WebP format to optimize display performance in AnQi CMS?

## Speed up website image loading: The secret of AnQiCMS image lazy loading and automatic WebP conversion In today's increasingly rich digital content, the quality and loading speed of website images directly affect user experience, search engine rankings, and the overall conversion rate of the website.Imagine if the images on a website load slowly, visitors are likely to leave before the content is fully displayed.The good news is that AnQiCMS has provided us with a set of efficient solutions, through the two functions of image lazy loading and automatic WebP conversion, so that the visual content of the website can be guaranteed in terms of quality at the same time

2025-11-09