I remember that when I first learned dedecms, I had a headache for a long time when I called the article. Today I edited a specially collected article about dedecms date formatting, hope to help you
The commonly used date Formatting Function mydate () exclusive to dedecms ()
| Code: [field: pubdate function = "mydate ('Y-m-d', @ me)"/] |
Style: 2013-08-07 |
| Code: [field: pubdate function = "mydate ('m-d', @ me)"/] |
Style: 08-07 |
| Code: [field: pubdate function = "mydate ('Y-m-d h: I: s', @ me)"/] |
Style: 09:14:38 |
The above three date formats are often used when we create websites. If you want to set a more personalized date, you can continue to look down.
Dedecms uses the PHP built-in date Formatting Function strftime ()
| Code: [field: pubdate runphp = 'yes'] @ me = str_replace ('-', '', strftime (" % Y-% m-% d % H: % m: % s ", @ me); [/field: pubdate] |
Style: August 07, 2013 09:14:38 |
Note: The above code is called in the arclist on the homepage list page. If you call the content, switch to the following code:
{Dede: field. pubdate function = "mydate ('Y-m-d', @ me )"/}
In addition, in most online tutorials, [field: pubdate function = 'strftime ("% Y % m month % dday % H point % m minute % s second", @ me) '/], can call August 07, 2013... the format of the date, but a Niu tried it, except that the first % Y will be parsed after all for normal string processing, and % s followed by Chinese, it will not be displayed directly, A friend who wants to know can tell Daniel q27856361,
The English letters after the percent sign (%) are as follows (TIPS: www. qmtx3.com). You can freely combine your own time format
% A abbreviation of the day of the week
% A full name of the day of the week
Abbreviation of % B month
% B full name
% C standard date time string
The last two digits of the Year % C
% D indicates the day of the month in decimal format.
% D month/day/year
% E indicates the day of the month in decimal format in the two-character field
% F-month-day
The last two digits of the Year % G. The year is based on the week.
% G year, based on the week Year
% H abbreviated month name
% H hour in 24-hour format
% I 12-hour
% J indicates the day of the year in decimal format.
Month in % m decimal format
% M decimal number of minutes
% N new line operator
% P equivalent display of local am or PM
% R 12 hours
% R display hour and minute: hh: mm
% S decimal seconds
% T horizontal Tab
% T display time in seconds: hh: mm: SS
% U the day of the week, Monday is the first day (value ranges from 0 to 6, Monday is 0)
% U indicates the week of the year. Sunday is regarded as the first day (the value ranges from 0 to 53)
% V indicates the week of the year, which is based on the year of the week.
% W decimal indicates the day of the week (the value ranges from 0 to 6, and Sunday is 0)
% W indicates the week of the year. Monday is the first day (from 0 to 53)
% X standard date string
% X standard time string
% Y does not contain the century's decimal year (the value ranges from 0 to 99)
% Y indicates the tenth year of the century.
% Z, % Z Time Zone name. If the time zone name cannot be obtained, an empty character is returned.
In fact, the above time format is rarely used. I have used dedecms for at least a few years, and it has always been or 08-07, this is also the most common form of dedecms date formatting.
Dedecms call date formatting