How to Change Date and Time Formats in WordPress

Dave Abargel,

Did you ever want to change the Date Format in WordPress? Perhaps you wanted to shorten the format, hide the year or view the clock?
One of our users recently asked whether or not there is a way to change the Date Format and the Time Format.
In this article, we’ll show you how to do change Date and Time formats in WordPress.

Date and Time Settings

WordPress comes with built-in functions that allow Users and Programmers to design the Date and Time.
You can change the Theme in Settings> General on the WordPress Admin Panel, then scroll down to Time Zone.

Time formats
Date and time settings in WordPress

Here you can choose the suitable Time Zone for your website, along with the Date and Time Format.
There are several built-in options you can choose from by clicking on the Radio Button, or insert your custom design.

Character Formatting for Date and Time in WordPress

Date and Time Formats are based on alphabetic characters representing time formatting. For example, the Y input will show the year in four digits, such as 2017.
Entering a smaller y value will display the year in two digits, such as 17. You can see the full list of formatting characters here.

These are some examples of common date and time formatting features:

M d, Y –   will display December 31, 2017 (M is month, d is two digit date, Y is the year in 4 digits)
d M, Y –   will display  31 December, 2017 (d is for day, M is for the month, Y is the  year in 4 digits)
F, Y d  –   will display December, 2017, 09 (F is months in text, Y is year in 4 digits and d for the date)
l, F, Y  –   will display Thursday, December, 2017 (L is day in text, F is month, year in 4 digits)
H: i: s  –  will display 12:27:26 (Hour: Minutes: Seconds)

You can try different designs in the Customization Box for Date and Time Settings.
After finishing the formatting, WordPress will show you a preview of the Date and Time.

Time formats example
Preview the Date and Time Formats in WordPress

Once the settings are saved, WordPress will use them on your site until you re-configure them.

How to display the Time next to a Date on WordPress posts

Another common question is how to display the Time next to the Date in WordPress posts.
The most difficult but preferred solution is to edit the Child Template of your WordPress site and add the following line if you want to view the Time.

 <?php echo get_the_time(); ?>

The Code will display the Time for the specific post or page.

Not all Novice Users want to create a Child Template and manipulate the code. However, for novices, there is an easier way to add the Time to the Date.

Technically, when WordPress displays a Date in your site’s posts it actually displays the time.
However, since most people only use the Date Format and Time Format for Date Formatting, there is no choice for the browser other than displaying the Date only.
If you have inserted time-related characters in the Date Format, then the Time will also be displayed. For example:

d / m / Y g: i – will display as 31/12/2017 12:47

Similarly, if necessary, you can also use Date Formatting Tags in the Format Time Format Field.
Depending on your needs, there are many things you can do in designing a Date and Time in WordPress.

For example, you can view the last time the post was updated, in text or in literature. Instead of a publication date.
You can also view current date and time and relative dates, such as “This post was posted 2 days ago”.
But we will expand on this subject in a separate article soon.

If at anytime you have questions or need a helping hand,  uPress offers  24/7 VIP Customer Service.

Did you like the article? Sign up for the uPress newsletter and always stay up-to-date.

Dave Abargel

VP and founder of uPress, developer of Backend & Frontend, specializes in improving performance for WordPress websites, handling advanced security issues, and marketing on social networks. He is an active partner in a number of interesting projects in the field, such as WiPi, Enable, Greenicon, Speedom, and more.

  • You might be interested…

  • One Reply to “How to Change Date and Time Formats in WordPress”

    Leave a Reply

    Your email address will not be published. Required fields are marked *