Home >Backend Development >PHP Tutorial >A complete list of date formatting forms called by dedecms, dedecms date format_PHP tutorial
I remember when I first learned dedecms, I had a headache for a long time about the date of the call article. Today’s editor is dedicated to I have collected and compiled an article about dedecms date formatting, I hope it will be helpful to everyone
dedecms’ unique and commonly used date formatting function MyDate()
代码:[field:pubdate function="MyDate('Y-m-d',@me)" /] | 样式:2013-08-07 |
代码:[field:pubdate function="MyDate('m-d',@me)" /] | 样式:08-07 |
代码:[field:pubdate function="MyDate('Y-m-d H:i:s',@me)" /] | 样式:2013-08-07 09:14:38 |
The above three date formats are often used when we make websites. If you want to set the date more personalizedly, you can continue to read below
dedecms uses PHP’s own date formatting function strftime()
代码:[field:pubdate runphp='yes']@me = str_replace('-', '', strftime("%Y年-%m月-%d日 %H:%M:%S", @me));[/field:pubdate] | 样式:2013年08月07日 09:14:38 |
Note: The above codes are all called in arclist on the home page list page. If the content is called, please switch it yourself, such as:
{dede:field.pubdate function="MyDate('Y-m-d',@me)"/}
In addition, [field:pubdate function='strftime("%Y year %m month %d day %H point %M minute %S second",@me)'/] written in most online tutorials can be called The date is in the form of August 7, 2013..., but Aniu tried it but it didn't work. Except for the first %Y, all the following ones will be parsed and processed as ordinary strings, and Chinese characters will be added after %S. It is no longer displayed. I hope friends who know can tell A Niu about Q27856361,
The specific meanings of the English letters after the percent sign (%) are as follows, (tips world WWW.QMTX3.COM) You can freely combine a time format of your own
%a abbreviation for day of the week
%A The full name of the day of the week
Abbreviation for %b month
%B The full name of the month
%c standard date time string
%C The last two digits of the year
%d The day of the month in decimal format
%D month/day/year
%e In a two-character field, the day of the month in decimal
%F Year-Month-Day
%g Last two digits of year, using week-based year
%G year, using week-based year
%h abbreviated month name
%H hour in 24-hour format
%I hour in 12-hour clock
%j The day of the year in decimal notation
%m month in decimal
%M Minutes in ten-hour format
%n newline character
%p local AM or PM equivalent display
%r 12 hours time
%R Display hours and minutes: hh:mm
%S decimal seconds
%t horizontal tab
%T Display hours, minutes and seconds: hh:mm:ss
%u The day of the week, Monday is the first day (values range from 0 to 6, Monday is 0)
%U The week number of the year, with Sunday as the first day (value from 0 to 53)
%V Week number of the year, using week-based year
%w Day of the week in decimal (values from 0 to 6, Sunday is 0)
%W The week number of the year, with Monday as the first day (value from 0 to 53)
%x standard date string
%X standard time string
%y decimal year without century (values from 0 to 99)
%Y decimal year with century part
%z, %Z time zone name, if the time zone name cannot be obtained, an empty character is returned.
In fact, the above time formats are rarely used. At least I have not used dedecms for several years. It has always been 2013-08-07 or 08-07. This is also the dedecms date format. The most commonly used form
I can’t see what effect you want based on the description, so let’s talk briefly. 19:May in the picture is H:M in the label. You might as well modify it according to dede’s label description, which is very detailed help.dedecms.com/v53/
pubdate is the time when the article was published, and of course it will not change