How to Change the Date and Time Format for WordPress Blog

How to Change the Date and Time Format for WordPress Blog

By default your WordPress blog will display date and time as “September 3, 2010” and “12:59 am“. When using the default template you can easily change the format by changing the General Settings from your WordPress Admin page. Go to Settings > General and change the settings using the button selections or using the custom form.

Customizing time format in WordPress

WordPress Admin General Setting page

However most custom themes have been pre-configured and require manual modifications. Open your HTML/PHP editor and search your WordPress theme files for this strings:

<?php the_time('F-j-Y') ?> *those in green may be different on your themes.

Change the green codes by referring to this table:

Day of Month
d Numeric with leading zeros 01-31
j Numeric with no leading zeros 1-31
S English ordinal suffix used after j st, nd, rd, th
Weekday
l Full name (lowercase L) Monday-Sunday
D Three letter name Mon-Sun
Month
m Numeric with leading zeros 01-12
n Numeric with no leading zeros 1-12
F Textual full January-December
M Textual three letters Jan-Dec
Year
Y Numeric 4 digits 1959, 2010, 2022
y Numeric 2 digits 59, 10, 22
Time
a Lowercase am, pm
A Uppercase AM, PM
g Hour in 12-hours format with no leading zeros 1-12
h Hour in 12-hours format with leading zeros 01-12
G Hour in 24-hours format with no leading zeros 0-23
H Hour in 24-hours format with leading zeros 00-23
i Minutes with leading zeros 00-59
s Seconds with leading zeros 00-59
T Timezone abreviation EST, MDT, GMT, UTC
Full Date/Time
c ISO 8601 2004-02-12T15:19:21+00:00
r RFC 2822 Thu, 21 Dec 2000 16:01:07 +0200

Table from WordPress.Org Codex: Formatting Date and Time

Example coding:

September 3rd, 2010 F jS, Y
Fri, 03/09/2010 D, d/m/Y
Friday, 3-9-2010, 11:10 PM l, j-n-Y, g:i A

Example on how to apply the codes to your WordPress themes.

Posted on Friday, September 3rd, 2010 Posted on <?php the_time('l, F jS, Y') ?>
Written by Ridhuan, 3-9-2010 at 11:15 PM Written by <?php the_author() ?>, <?php the_time('j-n-Y') ?> at <?php the_time('g:i A') ?>
Date Posted: Fri, 03/09/2010, 23:15 Date Posted: <?php the_time('D, d/m/Y, H:i') ?>

Actually I have not tried every codes I’ve written here so I am very sorry if you have problems applying them.

Share
Blog Traffic Exchange Related Posts Blog Traffic Exchange Related Websites

1 Comment »

  1. salam kenal, balas yah

    comment-bottom

RSS feed for comments on this post. TrackBack URL

Leave a comment

*


Notify me of followup comments via e-mail. You can also subscribe without commenting.

ss_blog_claim=82d6a1cd43b9ee976ddc41a2e546c430