Home > Backend Development > PHP Tutorial > How to display only the date but not the time on the phpcms content details page_PHP Tutorial

How to display only the date but not the time on the phpcms content details page_PHP Tutorial

WBOY
Release: 2016-07-13 09:49:58
Original
1229 people have browsed it

How to display only the date but not the time on the phpcms content details page

We know that when the default tag {$inputtime} is used on the content page, the format displayed is similar to 2014-03 -24 20:00:43 This kind of display effect has a very bad impact on the image of the collected website, because the time of collecting and publishing the website is very close to each other, and others will know it is the collected website at a glance.


So, can we only display the release date 2014-03-24? The answer is of course yes! Just use the tags below. The principle is to return the original value of the time first, and then use the DATE function to convert it.

Copy code

The code is as follows:

{date('Y-m-d',time($inputtime))}
{date('Y-m-d',strtotime($inputtime))}



Subsequent addition, after testing, the label {date('Y-m-d',strtotime($updatetime))} is also possible, but the article needs to be regenerated before it will take effect, otherwise the format of 1970-01-01 will be displayed, which should It may be caused by the fact that the article entered for the first time does not have the last update time.

   Note: For more exciting tutorials, please pay attention to the Bangke Home Web Design Tutorial column,

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1018921.htmlTechArticleHow to display only the date but not the time on the phpcms content details page. We know that the default tag {$inputtime} is used in The format displayed on the content page is similar to 2014-03-24 20:00:43, so...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template