In the process of modification, we will inevitably use the time function, which of course involves the time format of WordPress. Then we just have to make some corresponding changes to the time function: The_time (), we can achieve the effect we want, first I have to know the meaning of those parameters, so it will be handy. First look at the following table:
Parameters |
Parameter description |
Output Time format |
D |
Date |
06 |
J |
Date |
6 |
D |
Week |
One |
F |
Month |
January |
G |
Hours |
6 |
G |
Hours |
06 |
H |
Minutes |
6 |
H |
Minutes |
06 |
A |
Last afternoon |
am/pm |
A |
Last afternoon |
am/pm |
L |
Week |
Monday |
M |
Month |
01 |
M |
Month |
Jan |
N |
Month |
6 |
O |
Time |
+0800 |
R |
Full Date and time |
Mon, Jan 2010 20:30:10 +0800 |
S |
The suffix of a sequence type number |
St/th |
T |
Time |
Cst |
W |
Week |
2 |
W |
Week number |
22 |
Y |
Year |
10 |
Y |
Year |
2010 |
Z |
Days |
365 |
Here are some examples of WordPress setup time format:
Chinese date format setting, Month Date: For example: February 1, 2010, then the parameters of the time function of WordPress write:
The setting of the Chinese time, hours and seconds: For example: 22:22:22, then the parameters of the WordPress times function write:
Week format set, week: For example: Thursday, November 1, 2010, the parameters of the time function for WordPress are written like this:
Of course, sometimes our theme like the Chinese and English mixed lost date display format, for the use of English version of WordPress, this will do some small adjustments. Here, for example, the month in which the log time is displayed, we use the The_time (' M ') in the subject to print out the month value of a Sep abbreviation. But fortunately and unfortunately, WordPress will be very human for you to translate into "Nine", said Lucky, is because of the intelligent WordPress people feel happy, said unfortunately because I really do need Sep such English shorthand time format, this let me how to be good.
So what do we do at this time, from a functional point of view to solve this problem, reset, to avoid the Chinese.
To add a function:
Replace with:
Echo Date
This is when we find the time format we need.
WordPress Time Date Function Common code