How to Change Date and Time Formats in WordPress

Are you doing business internationally? Or perhaps you’re in a location that requires a 24-hour clock (many European and Middle Eastern cultures write in “army time” - like “Meeting at 18:00”.) If that’s the case with your target audience, you need to meet them where they are in the language and format they’re used to. Learn how to change the time zone if you’re targeting users in a specific location, or adapt the date and month to match local customs.

How to Change Date and Time Formats as part of your WordPress customization

One of the important ways to make your website stand out from your competitors, and match your WordPress customization to the needs of your users, is to change the time and date format. You might want to change the time zone if you’re targeting users in a specific location, or adapt the date and month settings to match local custom. Or you might choose to hide the year or display a 24-hour clock. 

We were recently asked how to change the date and time format, by a small business owner who was carrying out some WordPress customization on their own. As we explained the fairly easy process, we thought that more of our users might be interested to learn the same WordPress customization skills. As managed WordPress hosting experts, we have a wealth of knowledge to share!

Choosing pre-set date and time formats

Your WordPress site comes with a built-in WordPress customization for a few different date and time formats. Visitors who have User and Programmer status can choose their preferred date and time from the preset options. 

  • Go to your WordPress admin panel
  • Go to Settings > General
  • Scroll down to Time Zone
  • Choose a Date format
  • Choose a Time format

Here you can set the time zone for your website, along with the date and time format, and click Save Changes.

Migrate to uPress within 24 hours


WordPress customization for date and time using character formatting

If you’re not happy with any of these options, you can insert your own WordPress customization, using characters for date and time formatting. Here are some of the characters you need to know to set your own WordPress customization for date and time formatting: 

D - the date of the month in 2 digits, such as 31 or 07

M - the month in number, such as 11 for November

Y - the year in four digits, such as 2017

y - a lower-case y displays the year in 2 digits, such as 17

L - the day of the week, such as Sunday or Monday

F - the month in text, such as November

H - the hour

i - the minutes past the hour

S - seconds

You can see the full list here

You can test out different designs in the Custom box at the bottom of each set of options. When you’ve finished, you’ll see a preview of the date and time format.

If you’re happy with it, click Save. Your WordPress customization will be saved until you reset them. 

How to display the time as well as the date on WordPress posts

A lot of users ask us how to show the time next to the date on WordPress posts. There are a few different ways to carry out this WordPress customization. 

Edit the child template

Many users prefer to edit the child template for the whole WordPress site, even though this approach to WordPress customization is technically very difficult. You’ll need to navigate to the child template of your site, so go to your WordPress dashboard, click Appearance, click Themes, then click on the theme details. 

You’ll need to paste this line of code into your child template. 

<?php echo get_the_time(); ?>

And then you’re done. Every subsequent post or page will show the time as well as the date. 

Add time tags to your date formatting

Fortunately, there’s an easier, code-free way to add the time alongside the date. You might not know this, but whenever WordPress displays the date in a post, it also displays the time alongside it. It’s just that most people never add the time tags into the date box, so only the date is visible. 

You can change this by adding time characters alongside the date in your custom box. For example, 

d/m/Y h:i

Will appear on the screen as 31/11/2017 11:28

There are so many creative ways that you can apply WordPress customization to your WordPress site. For example, you can show the last time your post was updated instead of the date it was published, or display the publication date in relative terms, such as “Published 2 days ago.” But we’ll discuss these topics in more depth in a separate post. 

As managed WordPress hosting experts, we know what we're talking about, whether you need advice on the difference between managed vs. regular hosting, how to manage security updates, or even formatting the time and date on your WordPress site. You can trust us with the entire gamut of WordPress questions, so the only one left is... why aren't we hosting your WordPress site yet? Click below and join us.

Explore plans

hello world!

Read more about these topics!

Related Posts

How to force WordPress to check for updates

“If it ain’t broke, don’t fix it” doesn’t fly here. Yes, you have to update your plugins, because if you don’t, you are vulnerable to cyberattacks, and ain’t nobody got time for that. This is a quick, easy guide to “force” your website to update regularly.
Read More

The uPress Site Migration Tool

Our smooth, user-friendly Auto Migration Tool automates WordPress migration to make it friction-free. This user-friendly guide will teach you how to migrate your site in 1,2,3, go!
Read More

Why is it important to use the latest version of WordPress? Part 1

Every time a new WordPress version is released, our customers ask us if they should update their theme. Is it safe? What are the pros and cons of updating to the latest version? Learn about the potential effects of an update on your security, features and performance.
Read More
envelopemap-marker