Phpcms Call of date Time label

Source: Internet
Author: User

Reference URL: http://www.abcde.cn/info/show-23-892-1.html

1, Date time format display:

A standard type: {date (' y-m-d h:i:s ', $rs [' Inputtime ')} output: 2013-01-31 13:15:10

B Split: {date (' Y ', $rs [Inputtime]} year {date (' m ', $rs [Inputtime])} month {date (' d ', $rs [Inputtime])} Day output: January 31, 2013

C Extended Type:

{Date (' Y ', $inputtime);} 4-bit year output is: 2013 or 2014

{Date (' Y ', $inputtime);} 2-bit year output is: 10 or 11

{Date (' F ', $inputtime);} English month full name output is: January to December

{Date (' M ', $inputtime);} English month abbreviation output is: Jan to Dec

{date (' m ', $inputtime);} Leading 0 digit month output: 01 to 12

{Date (' n ', $inputtime);} Numeric month output: 1 to 12

{Date (' d ', $inputtime);} Leading 0-period output: 01 to 31

{Date (' J ', $inputtime);} The date output is: 1 to 31

{Date (' l ', $inputtime);} English week full name output: Sunday to Saturday

{Date (' D ', $inputtime);} English week abbreviation output is: Mon to Sun

{Date (' N ', $inputtime);} Format Numeric Week output: 1 to 7

{Date (' y-m-d h:i:s ', $rs [inputtime]+30*60)} Add some time after getting the article time

Article content release time label display 1970 workaround

When using Phpcms V9, it often appears that the call Article Time label will show 1970 years of problems
Phpcms the reason for the 1970-year V9 call time the PHP strtotime () function resolves the datetime description of any English text to a Unix timestamp. which

{Date (' Y ', Strtotime ($updatetime))} Uppercase Y shows 2013, lowercase y shows 13

{Date (' m-d ', Strtotime ($updatetime)} Capital is English month day, lowercase is numeric month day
{Date (' Y ', Time ($updatetime))} Gets the current timestamp

The UpdateTime and inputtime tags in the next phpcms tag differ:

①updatetime is the update time (also called the modification time, is the background of the article list to see the time);
②inputtime is the time to publish when you first write an article (that is, when you add an article or when you modify an article).

Generally, the release time does not change automatically, but the update time changes as the article changes. When we write the label on the front page, we usually write the release time, which will not cause the article that was written last year and change it into this year's article. Of course, if the time to write updates is not a big problem.

How to solve the issue of Phpcms V9 release time 1970 years :

If the {loop $data $k $v} is used, then the {date (' y-m-d h:i:s ', $v [Inputtime])} is used to invoke the application "V";
If you use {loop $data $r}, use {date (' y-m-d h:i:s ', $r [Inputtime])} to apply the "R" call.

This is called on the list page, and if it is on the article page, it is also possible to use {$inputtime} directly.

1970 Error Modified call: two-bit date notation: {date (' J ', $val [Inputtime]}} March 19, 2015

                Capital English month Abbreviation: {date (' M ', $val [Inputtime])} March 19, 2015 displays Mar.

Date: {date (' Y ', $val [Inputtime]} year {date (' m ', $val [Inputtime])} month {date (' d ', $val [Inputtime])} Day display March 19, 2015

              

Phpcms Call of date Time label

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.