Introduction
Method Setting the clock in WordPress This is one of the problems that most new users who have just started working with WordPress face. In this tutorial, we are going to teach you how to set the clock and solve the problem of the local time and date in WordPress.
How to set the WordPress clock?
The time and date settings in WordPress are both related to the general settings in WordPress. To set the time in WordPress, select the Settings option from the menus in the WordPress dashboard.
Then select Public or General from the Settings submenu.
After you enter the General Settings section, scroll down. You will see the Clock section.
Local time can vary depending on the country and region you live in. So, depending on where you live, select your local time from the list. If you live in Iran, set the desired local time to Tehran from the drop-down menu.
History structure:
In the next section, the date structure is visible. In this section, there are 4 default date structures that you can choose from. If you want your date to be displayed in a different way, enter your date display model in the box in the custom section.
There are three symbols in this section: the j symbol, the f symbol, and the Y symbol.
- Symbol j: If you put this symbol in the box, it will show you the day.
- F symbol: This is the symbol for the moon.
- Y symbol: It's for the show of the year.
Time structure
There are also 4 default structures for the time structure. You can choose from them as you wish. If you want the time to be displayed in a different way, enter your time display model in the box in the custom section.
There are several symbols in this section, including A, a, H, i, and g.
- H symbol: to indicate the hour
- The i symbol is used to indicate the minute.
- A symbol: To display as afternoon or morning in full
- Symbol a: To display afternoon and morning as abbreviated PM and PM.
- The g symbol: is for displaying in 12-hour format, which is shown as AM or PM.
- G symbol: If you want to display the time in 24-hour format, the capital G symbol is used.
- The symbol s: is used to indicate seconds.
By setting the Time Structure or Date Structure field to Custom, you can display the time and date on your site in a custom way. You can use any of the symbols mentioned above. Enter these symbols in the Custom field box. The output result will be shown to you next to the Custom field. Then save the changes to apply your changes.
Display time as code
If you are a programmer and want to use the time display code in your template's PHP file, you should use the_time code to display the time.
Generally, the_time command is used to display the time. If you want to display the time on your site in PHP code, you can use the following PHP code:
<? php the_time( ‘l, F jS, Y’ ); ? >You can change the date format as desired.












