A detailed introduction to PHPCMS v9 time stamp

Source: Internet
Author: User


Phpcms v9 Publish Time Inputtime format is what, write different, format different

The difference between the UpdateTime and inputtime tags in the phpcms label:

①updatetime is the update time (also called modified 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).

such as {date (' y-m-d ', $r [Inputtime])} represents the year-month-day, corresponding, y,m,d can be replaced, the meaning of the representative is also different

The known date () is a time function that sets a default time zone Date_default_timezone_set (' UTC ');

The following is the date (), the meaning of the representative (once done project, need to convert time format, part of the test, may not be full)

A: "AM" or "PM"

A: "AM" or "PM"

D: A few days, two digits; from "01″ to" 31″

D: Day of the week, 3 English letters, such as: "Fri"

F: Month, full name in English, such as: "January"

H:12 hours, from "01″ to" 12″

H: 24 hours, from "00″ to" 23″

G:12 hours, not 0; from "1″ to" 12″

G: 24 Hours, no supplement 0; from "0″ to" 23″

J: A few days, from "1″ to" 31″

L: Day of the week, full name in English, such as: "Friday"

I: cent; from "00″ to" 59″

M: Month, from "01″ to" 12″

N: Month; from "1″ to" 12″

M: Month, 3 English letters;

s: seconds; from "00″ to" 59″

S: The end of the word plus English ordinal number, two English letters, such as: "21th"

T: Specify the number of days for the month, from "28″ to" 31″

U: The total number of seconds

W: Number of days of the week, from "0 (Sunday)" to "6 (Saturday)"

Y: Year, four digits

Y: Year, two digits

Z: The first day of the year; from "1″ to" 366″

For example, if you want to get the date of the month in Phpcms, the format is {date (' y-m-d h:i:s ', $r [Inputtime])} 2016-08-04 09:30:45

If you want to get the day of the week, this needs to be converted because there is no direct conversion to the time stamp of the week (maybe, I didn't find it), then use PHP to convert


<?php
$date = $r [Inputtime]; $r [Inputtime] = ' 2014-09-09 00:20:46 '
$week = Array (' Sunday ', ' Monday ', ' Tuesday ', ' Wednesday ', ' Thursday ', ' Friday ', ' Saturday ');
echo $week [Date (' W ', $date)]; Week X
?>
Of course specific requirements, then do a specific conversion, the above is today to share in the project encountered in the time stamp problem.


Phpcms the reason for the 1970-year V9 call publishing time:

If called using the {loop $data $k $v}, use {date (' y-m-d h:i:s ', $v [Inputtime])} to apply ' V ', and if {loop $data}, use {date (' y-m-d h:i:s ' , $r [Inputtime])}, call to apply "R".
This is called on the list page, and it is possible to use {$inputtime} directly in the article page.

That is, you need to pay attention to the way the data is invoked, if the call data is empty, then display 0, the nature is 1970-01-01.

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.