How to Change Date and Time Format in WordPress

Are you looking for a way to change the date and time format in WordPress?

WordPress has a few default date and time formats that you can choose from. If you are not happy with these options, then you can also create a custom format for your website.

In this article, we will show you how to easily change the date and time format on your WordPress site.

Change date and time format in WordPress
How to Change Date and Time Format in WordPress 1

Why Change the Date and Time Format in WordPress?

WordPress uses the date/time format to show the publication and modification dates for blog posts in the dashboard and in the content editor for scheduling content.

This format also displays the publication or updated date of pages/posts and shows when comments were posted on your WordPress website’s front end.

Different regions of the world prefer and use different date and time structures. If you have a website that caters to an international audience, you may want to change the date/time format in your blog posts to create a more localized experience for your users.

Plus, displaying the date and time in your blog posts can help improve your website’s visibility by highlighting the freshness of your content more effectively.

This is because search engines are likely to rank your post higher if the content is fresh and updated. For more details, you can see our guide on content decay in WordPress.

Having said that, let’s see how to easily change the date and time format in WordPress. We will also show you how to easily display the time next to dates in WordPress posts:

  • How to Change Date and Time Format in WordPress
  • How to Display Time Next to Dates in Your WordPress Posts
  • Bonus: Display Today’s Date in WordPress

How to Change Date and Time Format in WordPress

You can easily change date and time formats using the built-in features in your WordPress dashboard.

First, you must visit the Settings » General page from the WordPress admin sidebar and scroll down to the ‘Timezone’ section. Once you are there, you can choose a timezone for your website from the dropdown menu.

For example, if you live in Costa Rica, then you can select that option from the dropdown menu.

Choose timezone from the dropdown menu
How to Change Date and Time Format in WordPress 2

Next, scroll down to the ‘Date Format’ option, where you can select a date arrangement.

These format options are based on alphabetic characters that represent a time arrangement.

Choose a date format
How to Change Date and Time Format in WordPress 3

If you don’t want to use any of the available date formats, then you can create your own by choosing the ‘Custom’ option and typing characters into the box next to it.

For example, if you type the uppercase letter Y, then your date format will display the year in numeric four digits, like 2014.

Similarly, if you enter a lowercase y, it will output the year in two numeric digits, like 14.

Create custom date format
How to Change Date and Time Format in WordPress 4

Here is a list of some of the most commonly used date and time format characters:

M d, Y – Nov 06, 2023
d M, Y – 06 Nov, 2023
F jS, Y – November 6th, 2023
l, F jS, Y – Thursday, November 6th, 2023
H:i:s – 21:26:12

For more details, you may want to see the full list of format string characters. You can use this as a guide for creating your custom date arrangement.

Once you have created a format, WordPress will show you a preview of what your date will look like.

Next, head over to the ‘Time Format’ section. From here, you can choose any of the pre-made time formats.

However, if you don’t find any of the formations suitable, then you can also customize your own by choosing the ‘Custom’ option.

Once you have done that, you will also be able to see your time preview next to the ‘Preview’ option.

Choose time format according to your liking
How to Change Date and Time Format in WordPress 5

If you are unsure about the format characters, then you can simply click on the ‘Documentation on date and time formatting’ link in the ‘Time Format’ section.

Once you are done, don’t forget to click the ‘Save Changes’ button to store your settings.

Now, you can visit your WordPress website to view the change in date format in your posts.

Preview of date in blog post
How to Change Date and Time Format in WordPress 6

How to Display Time Next to Dates in Your WordPress Posts

By default, WordPress does not display the publication time next to the date in your blog posts.

However, you can easily show the time by editing your WordPress theme and adding custom code to it.

Some tutorials will tell you to create a child theme to do this. However, keep in mind that the smallest error while adding the code can break your website, making it inaccessible.

That is why we recommend always using WPCode to add code to your website. It is the best WordPress code snippets plugin on the market that makes it safe and easy to add custom code.

First, you need to install and activate the WPCode plugin. For detailed instructions, you may want to see our beginner’s guide on how to install a WordPress plugin.

Note: WPCode also has a free version that you can use for this tutorial. However, upgrading to the pro plan will give you access to a cloud library of code snippets, smart conditional logic, and more.

Upon activation, head over to the Code Snippets » + Add Snippet page from the WordPress admin sidebar.

Once you are there, click the ‘Use Snippet’ button under the ‘Add Your Custom Code (New Snippet)’ option.

Add new snippet
How to Change Date and Time Format in WordPress 7

This will take you to the ‘Create Custom Snippet’ page, where you can start by typing a name for your code snippet. This name won’t be displayed on the front end and is only for your identification.

After that, select the ‘PHP Snippet’ option from the Code Type dropdown menu in the right corner of the screen.

Choose PHP Snippet option for the displaying time next to dates in post snippet
How to Change Date and Time Format in WordPress 8

Next, simply copy and paste the following code into the ‘Code Preview’ box:

Once you’ve done that, you can leave the code as it is or customize the layout for date and time by changing the values after return.

Remember that you will need to use format characters to create your own custom date/time arrangement.

add format characters in the code snippet
How to Change Date and Time Format in WordPress 9

After that, scroll down to the ‘Insertion’ section and choose the ‘Auto Insert’ mode.

The custom code will be automatically executed on your website upon activation.

Choose an insertion method
How to Change Date and Time Format in WordPress 10

Finally, scroll back to the top and toggle the ‘Inactive’ switch to ‘Active’.

After that, don’t forget to click the ‘Save Snippet’ button to store your changes.

Save snippet for displaying date and time in WordPress posts
How to Change Date and Time Format in WordPress 11

Now, you can visit your WordPress blog to view the time and date displayed in your blog posts.

Keep in mind that once you activate this code snippet, the default WordPress date and time formats won’t be displayed on your website.

Preview for date and time
How to Change Date and Time Format in WordPress 12

Bonus: Display Today’s Date in WordPress

Apart from displaying the publication date, you can also show the current date and time on your pages and posts.

This can help enhance your post’s relevance, promote transparency, and improve the overall user experience on your website.

You can easily display the current date on your website by adding custom code using WPCode.

It is the best WordPress code snippets plugin on the market that lets you add custom code without breaking your site.

You will need to use this code snippet:

This code will then display the current date on your pages and post using the date and time format that you have selected on the WordPress dashboard.

For more detailed instructions, you can see our tutorial on how to display today’s date in WordPress.

Preview of displaying the current date on your blog post
How to Change Date and Time Format in WordPress 13

We hope this article helped you learn how to easily change the date and time format in WordPress. You may also want to see our tutorial on how to remove date and time from WordPress comments and our expert picks for the best WordPress calendar plugins.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Lượt xem: 16

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *