{"id":983,"date":"2025-03-24T14:28:12","date_gmt":"2025-03-24T14:28:12","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-to-change-date-and-time-notations\/"},"modified":"2025-04-03T15:24:33","modified_gmt":"2025-04-03T14:24:33","slug":"how-to-change-date-and-time-notations","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/code-snippets\/how-to-change-date-and-time-notations\/","title":{"rendered":"How to Change Date and Time Notations?"},"content":{"rendered":"\n<p>By default, the date and timepicker in GD follows the 12-hour notation, wherein it&nbsp;goes from 0-12 pm and 0-12 am. You can, however, change it to 24-hour notation with the help of a simple code snippet.&nbsp;<\/p>\n\n\n\n<p>Don&#8217;t forget to also change your WP settings to 24hr time in WP Admin &#8211; Settings &#8211; General<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Changing Date and Time Notation<\/h2>\n\n\n\n<p>Use the following code snippet to change the date and time notation to 24-hour model:&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-info mb-3\" role=\"alert\"><span class=\"fas fa-info-circle me-2\"><\/span><span class=\"flex-grow-1\">We recommend using the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\">Code Snippets<\/a> plugin to add snippets to your site.&nbsp;<\/span><\/div>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">\/**\n * Event times 24hr timepicker.\n *\/\nfunction gd_snippet_event_times_24hr( $attrs = array() ) {\n\t$attrs&#091;&#039;data-alt-format&#039;&#093; = &#039;H:i&#039;;\n\t$attrs&#091;&#039;data-time_24hr&#039;&#093; = &#039;true&#039;;\n\n\treturn $attrs;\n}\nadd_filter( &#039;geodir_event_aui_start_end_time_attrs&#039;, &#039;gd_snippet_event_times_24hr&#039;, 11, 1 );\n\n\/**\n * Business Hours: Use 24 hour time format in time picker.\n *\/\nfunction gd_snippet_business_hours_24hr_params( $params ) {\n\t$params&#091;&#039;time_24hr&#039;&#093; = true;\n\treturn $params;\n}\nadd_filter( &#039;ayecode_ui_calendar_params&#039;, &#039;gd_snippet_business_hours_24hr_params&#039;, 11, 1 );\n\nfunction gd_snippet_business_hours_24hr_format( $time_format ) {\n\treturn &quot;H:i&quot;;\n}\nadd_filter( &#039;geodir_business_hours_input_time_format&#039;, &#039;gd_snippet_business_hours_24hr_format&#039;, 11, 1 );<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>Furthermore, if you wish to change text strings and further customize or localize GD, you should consider going through our <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/how-to-translate-or-localize-geodirectory\/\">guide to translating or localizing GeoDirectory<\/a>.&nbsp;<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By default, the date and timepicker in GD follows the 12-hour notation, wherein it&nbsp;goes from 0-12 pm and 0-12 am. You can, however, change it to 24-hour notation with the help of a simple code snippet.&nbsp; Don&#8217;t forget to also change your WP settings to 24hr time in WP Admin &#8211; Settings &#8211; General Changing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[855,849,850,851,852,853,854],"article\/categories":[211,433],"class_list":["post-983","gd_place","type-gd_place","status-publish","hentry","gd_place_tags-event-dates","gd_place_tags-date-notation","gd_place_tags-24-hour-format","gd_place_tags-time-notation","gd_place_tags-date-and-time","gd_place_tags-timepicker","gd_place_tags-dates","gd_placecategory-tips-tricks-more","gd_placecategory-code-snippets"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/983","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=983"}],"version-history":[{"count":0,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/983\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=983"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=983"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}