{"id":64231,"date":"2022-09-29T13:02:18","date_gmt":"2022-09-29T13:02:18","guid":{"rendered":"\/tutorials\/?p=64231"},"modified":"2025-04-23T09:45:04","modified_gmt":"2025-04-23T09:45:04","slug":"wordpress-date-format","status":"publish","type":"post","link":"\/in\/tutorials\/wordpress-date-format","title":{"rendered":"WordPress Date Format: How to Change Date and Time in WordPress"},"content":{"rendered":"<p>Your WordPress posts automatically display your website date and time. However, as the WordPress site owner, you may want to change or customize the date and time format to your preferences.<\/p><p>Fortunately, WordPress has a function that lets you freely configure your site&rsquo;s date and time format, including the one on your homepage and each post. Keep reading this article to learn how to change or customize your WordPress time and date format easily.<\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Mega-WordPress-Cheat-EN.pdf\" target=\"_blank\" rel=\"noopener\">Download all in one WordPress cheat sheet<\/a><\/p><p>\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-change-the-date-and-time-format-in-wordpress\">How to Change the Date and Time Format in WordPress<\/h2><ol class=\"wp-block-list\">\n<li>In the <a href=\"\/in\/tutorials\/wordpress\/how-to-login-to-wordpress-dashboard\">WordPress dashboard<\/a>, go to <strong>Settings<\/strong> -&gt;<strong> General<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/The-general-menu-in-WordPress-settings..png\"><img decoding=\"async\" width=\"1024\" height=\"476\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/The-general-menu-in-WordPress-settings.-1024x476.png\" alt=\"The general menu in WordPress settings\" class=\"wp-image-65070\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/The-general-menu-in-WordPress-settings.-1536x715.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/The-general-menu-in-WordPress-settings.-300x140.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/The-general-menu-in-WordPress-settings.-150x70.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/The-general-menu-in-WordPress-settings.-768x357.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/The-general-menu-in-WordPress-settings..png 1896w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"2\">\n<li>In the <strong>General <\/strong>settings page, scroll down until you find the <strong>Date Format <\/strong>and <strong>Time Format <\/strong>menu.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Date-Format-and-Time-Format-options-in-WordPress-settings..png\"><img decoding=\"async\" width=\"1024\" height=\"451\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Date-Format-and-Time-Format-options-in-WordPress-settings.-1024x451.png\" alt=\"Date Format and Time Format options in WordPress settings\" class=\"wp-image-65069\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/Date-Format-and-Time-Format-options-in-WordPress-settings.-1536x677.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/Date-Format-and-Time-Format-options-in-WordPress-settings.-300x132.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/Date-Format-and-Time-Format-options-in-WordPress-settings.-150x66.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/Date-Format-and-Time-Format-options-in-WordPress-settings.-768x338.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/Date-Format-and-Time-Format-options-in-WordPress-settings..png 1900w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"3\">\n<li>Feel free to choose the date and time format that suits your WordPress site the most. You can also input an alternate format in the <strong>Custom <\/strong>box. In the next section, we will explain format strings that can help you create your ideal custom format.<\/li>\n\n\n\n<li>Check the preview to make sure you chose the correct format. If you use punctuation marks like commas or dashes, keep note that they will be used literally.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/WordPress-date-format-settings-preview..png\"><img decoding=\"async\" width=\"686\" height=\"295\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/WordPress-date-format-settings-preview..png\" alt=\"WordPress date format settings preview\" class=\"wp-image-65072\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/WordPress-date-format-settings-preview..png 686w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/WordPress-date-format-settings-preview.-300x129.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/WordPress-date-format-settings-preview.-150x65.png 150w\" sizes=\"(max-width: 686px) 100vw, 686px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"5\">\n<li>Click <strong>Save<\/strong> <strong>Changes <\/strong>to apply the new date and time formatting.<\/li>\n<\/ol><p>Alternatively, you can change your website date and time format using the <a href=\"\/in\/tutorials\/wordpress-page-template\">WordPress template file<\/a>. This option is especially useful when your theme or plugin files have their own default date and time format.<\/p><p>In the template file, find the WordPress tag functions <strong>the_date() <\/strong>and <strong>the_time()<\/strong>. These functions display the date and time format set in your WordPress dashboard.<\/p><h2 class=\"wp-block-heading\" id=\"h-wordpress-time-and-date-formats\">WordPress Time and Date Formats<\/h2><p>In this section, you will learn more about the WordPress time and date format strings and characters.<\/p><p>On the <strong>Settings&rsquo; General <\/strong>page, next to each option in <strong>Date Format <\/strong>and <strong>Time Format<\/strong>, there is a series of characters called the <strong>format string<\/strong>.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/WordPress-date-and-time-format-string-options..png\"><img decoding=\"async\" width=\"672\" height=\"546\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/WordPress-date-and-time-format-string-options..png\" alt=\"WordPress date and time format string options\" class=\"wp-image-65071\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/WordPress-date-and-time-format-string-options..png 672w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/WordPress-date-and-time-format-string-options.-300x244.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/09\/WordPress-date-and-time-format-string-options.-150x122.png 150w\" sizes=\"(max-width: 672px) 100vw, 672px\" \/><\/a><\/figure><\/div><p>These format characters represent different elements of date and time structure. For example, here&rsquo;s what each character in the <strong>m\/d\/Y <\/strong>format string represents:<\/p><ul class=\"wp-block-list\">\n<li><strong>m <\/strong>&ndash; the numeric month with a leading zero.<\/li>\n\n\n\n<li><strong>d <\/strong>&ndash; the numeric day of the month with a leading zero.<\/li>\n\n\n\n<li><strong>Y <\/strong>&ndash; the four-digit year.<\/li>\n<\/ul><p>Therefore, this string will output:<\/p><p><strong>08\/29\/2022<\/strong><\/p><p>Since WordPress is written in the <a href=\"\/in\/tutorials\/what-is-php\/\">PHP programming language<\/a>, you can create your own custom structure string using the following date and time format characters:<\/p><figure tabindex=\"0\" class=\"wp-block-table is-style-regular\"><table><tbody><tr><td><strong><strong>Parameter<\/strong><\/strong><\/td><td><strong>Display<\/strong><\/td><td><strong>Example<\/strong><\/td><\/tr><tr><td><strong>Month<\/strong> <\/td><td><\/td><td><\/td><\/tr><tr><td>F<\/td><td>The month&rsquo;s full name<\/td><td>January &ndash; December<\/td><\/tr><tr><td>M<\/td><td>The month&rsquo;s three-letter abbreviation<\/td><td>Jan &ndash; Dec<\/td><\/tr><tr><td>m<\/td><td>The numeric month with leading zeros<\/td><td>01 &ndash; 12<\/td><\/tr><tr><td>n<\/td><td>The numeric month without leading zeros<\/td><td>1 &ndash; 12<\/td><\/tr><tr><td><strong>Day of the month<\/strong><\/td><td><\/td><td><\/td><\/tr><tr><td>n<\/td><td>The numeric day of the month with leading zeros<\/td><td>1 &ndash; 12<\/td><\/tr><tr><td>d<\/td><td>The numeric day of the month with leading zeros<\/td><td>01 &ndash; 31<\/td><\/tr><tr><td>j<\/td><td>The numeric day of the month without leading zeros<\/td><td>1 &ndash; 31<\/td><\/tr><tr><td>S<\/td><td>The English suffix for the numeric day of the month<\/td><td>st (in 1st), nd (in 2nd)<\/td><\/tr><tr><td><strong>Day of the week<\/strong><\/td><td><\/td><td><\/td><\/tr><tr><td>I<\/td><td>The day of the week&rsquo;s full name<\/td><td>Monday &ndash; Sunday<\/td><\/tr><tr><td>D<\/td><td>The day of the week&rsquo;s three-letter abbreviation<\/td><td>Mon &ndash; Sun<\/td><\/tr><tr><td><strong>Year<\/strong><\/td><td><\/td><td><\/td><\/tr><tr><td>Y<\/td><td>The four-digit year<\/td><td>2022<\/td><\/tr><tr><td>y<\/td><td>The two-digit year<\/td><td>22<\/td><\/tr><tr><td><strong>Time<\/strong><\/td><td><\/td><td><\/td><\/tr><tr><td>a<\/td><td>Lower case am or pm<\/td><td>am, pm<\/td><\/tr><tr><td>A<\/td><td>Uppercase AM or PM<\/td><td>AM, PM<\/td><\/tr><tr><td>g<\/td><td>The hour in 12-hour format without leading zeros<\/td><td>1 &ndash; 12<\/td><\/tr><tr><td>h<\/td><td>The hour in 12-hour format with leading zeros<\/td><td>01 &ndash; 12<\/td><\/tr><tr><td>G<\/td><td>The hour in 24-hour format without leading zeros<\/td><td>0 &ndash; 23 <\/td><\/tr><tr><td>H<\/td><td>The hour in 24-hour format with leading zeros<\/td><td>0 &ndash; 23<\/td><\/tr><tr><td>i<\/td><td>Minutes with leading zeros<\/td><td>00 &ndash; 59<\/td><\/tr><tr><td>s<\/td><td>Seconds with leading zeros<\/td><td>00 &ndash; 59<\/td><\/tr><tr><td>T<\/td><td>The timezone abbreviation<\/td><td>PST, EDT<\/td><\/tr><tr><td><strong>Full date and time<\/strong><\/td><td><\/td><td><\/td><\/tr><tr><td>c<\/td><td>ISO 8601 format<\/td><td>2022-08-29T18:56:24+00:00<\/td><\/tr><tr><td>r<\/td><td>RFC 2822 format<\/td><td>Mon, 29 August 2022 18:56:24+0200<\/td><\/tr><tr><td>U<\/td><td>Unix Timestamp (seconds since the Unix epoch, January 1, 1970 00:00:00 GMT)<\/td><td>1661842310<\/td><\/tr><\/tbody><\/table><\/figure><p>There are additional customization options you can set from WordPress dashboard&rsquo;s <strong>Settings <\/strong>page or in the template file code, such as:<\/p><ul class=\"wp-block-list\">\n<li><strong>Escaping<\/strong> &ndash; to use a literal alphabet without it being translated to a format character, use the backlash. For example, if you want to display the word <strong>at<\/strong>, enter <strong>\\a\\t<\/strong>.<\/li>\n\n\n\n<li><strong>Localizing <\/strong>&ndash; to change the month and day names into your website&rsquo;s current locale, replace <strong>date()<\/strong> with <strong>wp_date()<\/strong>. For example, instead of <strong>date( &lsquo;F jS, Y&rsquo; )<\/strong>, it should be <strong>wp_date( &lsquo;F jS, Y&rsquo; )<\/strong>.<\/li>\n<\/ul><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Suggested Reading<\/h4>\n                    <p>Learn about <a href=\"\/in\/tutorials\/php-set-timezone\">setting PHP timezone<\/a> for an easier website management.<\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-examples-of-time-and-date-format-strings\">Examples of Time and Date Format Strings<\/h2><p>You can incorporate various characters into your string and create different date and time format options. Here are some format string examples and their outputs.<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Format String<\/strong><\/td><td><strong>Output<\/strong><\/td><\/tr><tr><td><strong>F j, Y g: i a<\/strong><\/td><td>August 29, 2022 10:45 am<\/td><\/tr><tr><td><strong>F, Y<\/strong><\/td><td>August, 2022<\/td><\/tr><tr><td><strong>l, F jS, Y<\/strong><\/td><td>Monday, August 29th, 2022<\/td><\/tr><tr><td><strong>Y\/n\/d<\/strong><\/td><td>2022\/8\/29<\/td><\/tr><tr><td><strong>Y\/m\/d \\a\\t g:i A<\/strong><\/td><td>2022\/08\/29 at 10:45 AM<\/td><\/tr><tr><td><strong>\\t\\i\\m\\e\\: G:i<\/strong><\/td><td>time: 23:45<\/td><\/tr><tr><td><strong>F j, Y<\/strong><\/td><td>August 29, 2022<\/td><\/tr><tr><td><strong>M j, Y @ H:i<\/strong><\/td><td>Aug 29, 2022 @ 09:30<\/td><\/tr><\/tbody><\/table><\/figure><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/in\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner-1024x300.png\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/New-WP_in-text-banner-1024x300.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/New-WP_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/New-WP_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/New-WP_in-text-banner-768x225.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/New-WP_in-text-banner-1536x450.png 1536w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/New-WP_in-text-banner.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>In this article, you have learned to customize your WordPress site&rsquo;s date and time format using the built-in function on the dashboard. Aside from the default date and time formats, you can customize your date or time format using strings.We hope this article has helped you learn about formatting the date and time in WordPress. To learn more about WordPress, check out our <a href=\"\/in\/tutorials\/wordpress\">WordPress tutorial<\/a>.<\/p><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Other WordPress Must-Knows<\/h4>\n                    <p><a href=\"\/in\/tutorials\/backup-wordpress\">How to Backup a WordPress Website<\/a><br>\n<a href=\"\/in\/tutorials\/wordpress-malware-removal\">WordPress Malware Removal Guide<\/a><br>\n<a href=\"\/in\/tutorials\/how-to-undo-changes-in-wordpress\">How to Undo Changes in WordPress<\/a><br>\n<a href=\"\/in\/tutorials\/wordpress\/how-to-clear-wordpress-cache\">How to Clear Cache in WordPress<\/a><br>\n<a href=\"\/in\/tutorials\/optimize-images-wordpress\/\">How to Optimize Images in WordPress<\/a><br>\n<a href=\"\/in\/tutorials\/how-to-secure-wordpress\">Guide to WordPress Security<\/a><br>\n<a href=\"\/in\/tutorials\/speed-up-wordpress\">How to Speed Up WordPress<\/a><\/p>\n                <\/div>\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your WordPress posts automatically display your website date and time. However, as the WordPress site owner, you may want to change or customize the date and time format to your preferences. Fortunately, WordPress has a function that lets you freely configure your site&rsquo;s date and time format, including the one on your homepage and each [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/in\/tutorials\/wordpress-date-format\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":372,"featured_media":79786,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"","rank_math_description":"","rank_math_focus_keyword":"","footnotes":""},"categories":[22635,22633],"tags":[],"class_list":["post-64231","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-management","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/wordpress-date-format","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/formato-data-wordpress","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/wordpress-date-format","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/wordpress-date-format-how-to-change-date-and-time-in-wordpress","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/wordpress-date-format-how-to-change-date-and-time-in-wordpress","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/formato-data-wordpress","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/wordpress-date-format","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/wordpress-date-format","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/wordpress-date-format","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/wordpress-date-format","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/64231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/users\/372"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/comments?post=64231"}],"version-history":[{"count":16,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/64231\/revisions"}],"predecessor-version":[{"id":101087,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/64231\/revisions\/101087"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media\/79786"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media?parent=64231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/categories?post=64231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/tags?post=64231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}