Changing The Date and Time Formats in WordPress

Every post you publish is automatically marked with a date format. There may be numerous places in your theme where the date and time format is used. With WordPress you can completely customize this date/time format. WordPress has built-in options in its dashboard for changing date and time format. So let’s learn about changing the date and time formats in WordPress using dashboard and also create our own custom format using string formats.

Changing The Date and Time Formats in WordPress Using Admin Dashboard

Login to your admin dashboard and visit Settings > General page in your dashboard. You can find the date format and time format options in the page.

Changing the Date and Time Formats in WordPress

You can choose one of the formats according to the need of your website and save the changes. The last option called custom is for giving formats that are not available in the option. You can enter the string formats for the desired date and time display in the custom box. The list of some popular string format is given in the next part of the article below.

Creating a Custom Date Format using Format String

In WordPress there are pre-defined tags and functions like the_time() and the_date() which can be used to retrieve the information about date and time. These functions accept certain type of parameters called the format strings. Format string includes some kind of format characters that help you to determine the way date and time are displayed. Let’s see an example.

When we use

the_time('l, F jS, Y');

We get a current date that looks like this in the output

Tuesday, January 17th, 2017 

In this example  ‘l, F jS, Y’ is the string format that used as the parameter of function the_time().

For complete list of format strings you can check the PHP Manual full documentation. Some commonly used format strings along with their output are as follows.

  • F j, Y g:i a – January 17, 2017 12:50 am
  • F j, Y – January 17, 2017
  • F, Y – January, 2017
  • g:i a – 12:50 am
  • g:i:s a – 12:50:48 am
  • l, F jS, Y – Tuesday, January 17th, 2017
  • M j, Y @ G:i – Jan 7, 2017 @ 0:50
  • Y/m/d \a\t g:i A – 2017/01/17 at 12:50 AM
  • Y/m/d \a\t g:ia – 2017/01/17 at 12:50am
  • Y/m/d g:i:s A – 2017/01/17 12:50:48 AM
  • Y/m/d – 2017/01/17

You can use these string formats with the_time() function. At the general setting page, you can find the custom box of the time and date format where you can enter these string formats.

Also Read:   Steps to Add Favicon in WordPress Site

Available Tools in creating String Formats

You can use the date/time sting format generator tools too. Website like has built in Date/Time string format generator. Simply visit, select your language as PHP and then choose the type of date you want to display. At the bottom of the page, you can see the string format that you selected and the live preview of the format. You can simply copy the format code from the bottom copy textbox and paste it in your website code.

The general users as well as developers can use these methods for changing the date and time formats in their WordPress website. We hope the article was helpful.If you want to change the permalink of your website, you can read our other article on “How to Create Custom Permalinks in WordPress”. If you want to add some custom emoticons to your website you can get some help from article ”How to Add Custom Emoticons in WordPress”.

The following two tabs change content below.

Kantiman Bajracharya

Kantiman Bajracharya is a freelance web developer. He is a computer geek who has a Bachelor’s degree in Computer Engineering. He has earned lots of satisfied customers while working for numerous successful projects. He is also a WordPress theme creator and web article writer. On free time he likes reading philosophy books, traveling and playing chess.

Share This Post