SoFunction
Updated on 2025-03-10

dedecms date and time format

Date time format (use strftime() function to format time) 0

front page:
([field:pubdate function='strftime("%m-%d",@me)'/])==(5-15)
([field:pubdate function='strftime("%b %d, %Y",@me)'/])==(May 15, 2008)

List page:
[field:pubdate function="GetDateTimeMK(@me)"/]==2008-1-1 18:30:02
[field:pubdate function="GetDateMK(@me)"/]==2008-05-15

Content page:
{dede:field name='pubdate' function='GetDateMk(@me)'/}==2008-05-15
{dede:field name='pubdate' function='strftime("%b %d, %Y",@me)'/}==May 15, 2008

Use strftime() function to format the time:

%a Abbreviation of the day of the week
%A The full name of the day of the week
%b abbreviation of monthly points
%B The full name of month
%c Standard time string of date
The last two digits of the year %C
%d decimal represents the day of each month
%D Months/days/year
%e In the two-character field, which day of the month is represented in decimal
%F Year-Month-Day
%g The last two digits of the year, using the week-based year
%G Years, using week-based years
%h abbreviated month name
%H 24-hour hours
%I 12-hour hours
%j Decimal represents the day of each year
%m Decimal month
%M The number of minutes represented by ten-hour system
%n new line character
%p Local AM or PM equivalent display
%r 12 hours
%R Display hours and minutes: hh:mm
%S Decimal seconds
%t horizontal tab character
%T Display time, minute and second: hh:mm:ss
%u What day of the week, Monday is the first day (values ​​from 0 to 6, Monday is 0)
%U What week of year, use Sunday as the first day (value from 0 to 53)
%V What week of each year, using week-based years
%w The day of the week in decimal (values ​​from 0 to 6, Sunday is 0)
%W What week of each year, make Monday 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 The tenth-system year with the century part
%z, %Z time zone name, if the time zone name cannot be obtained, the empty character will be returned.