Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

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

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

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

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

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

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

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 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

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

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

add_filter( 'pre_option_date_format', function( $date_format ) {
	if ( is_admin() ) {
		return $date_format;
	}

	return 'l, F jS, Y H:i:s';
});

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

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

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

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

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:

function wpb_date_today($atts, $content = null) {
extract( shortcode_atts( array(
        'format' => ''
    ), $atts ) ); 
 
if ($atts['format'] == '') {
$date_time .= date(get_option('date_format'));
}  else {
$date_time .= date($atts['format']);
}
return $date_time;
}
add_shortcode('date-today','wpb_date_today');

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

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

20 CommentsLeave a Reply

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Mrteesurez

    Thanks for the guide to show time and date in post, this is very useful for news websites that publish new fresh updates time to time, show today’s day and date will show it as fresh news to users. It will definitely boost click through rate on search results as readers are looking for fresh news with latest dates. I have one news blog I used to publish local educational news about admission and exams update. I will try implement the function in it. Thanks for sharing it.

  3. Tahir Khan

    Hi, it doesn’t work in most of cases try to provide the solution what if theme is overriding the date and time Format.
    Thanks

    • WPBeginner Support

      If your theme is overriding the date and time format, we would recommend reaching out to the support for the specific theme that you are using and they should be able to let you know if their theme has a specific styling that can be changed to fix the issue :)

      Admin

  4. Krishna

    How to translate date to specific language like hindi?

    • WPBeginner Support

      You would either set your site’s language to the language you’re wanting or reach out to your theme’s support should it not be translating correctly.

      Admin

  5. Alex Abir

    Showing false time on my WordPress theme single page.
    How to Solve?

    • WPBeginner Support

      You would want to reach out to your theme’s support to see if it could be an error with the theme itself

      Admin

  6. Courtney Stevens

    How do I change the date format for posts? The date format for my theme is for example, October 26th, 2018 but I would like it to be October 26, 2018 without the “th” after the date. The general settings has the date format as what I want but when I look at a page with a blog post it still has the other formatting with the th. Help!

  7. Danold

    hello, i’ve a problem.i have changed the date format as you demonstrated but when i publish an article, the date format is always in an other form, i am using peflican theme

    • WPBeginner Support

      Hi,

      Try previewing your site with a default theme. See if that resolves the issue. If it does, then this means your theme is overriding the WordPress date format.

      Admin

  8. MUMBERE AUSBEL

    You guys are the best.

  9. Irfan

    Thank you sooo much it help me alot :)

  10. Scott

    Weird! I can not get the to show anything.

  11. Gabriele

    Hi, if I would set the WP clock one year advance is it possibile?

  12. Matthew Spence

    How do you fix the date? It is not the day after tomorrow.

  13. Alice

    The current wordpress formatting is different from the one shown here. I can’t seem to even be able to find the timezine in the settings now for wordpress,

  14. Michelle Stokes Decorator

    I don’t want to see the dates on smart phones, is there a way I can take the dates off all together so my site looks cleaner on the phones? Thanks….

  15. WPBeginner Staff

    It will only affect the display of dates on your pages. It will not change your permalinks.

  16. Kristine

    Will it change all my old posts too? Or only new posts going forward? I have wanted to change my format for over a year, but I have so many backlinks out there. I’m afraid it will ruin all my traffic.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.