{"id":1766,"date":"2021-05-14T11:58:18","date_gmt":"2021-05-14T11:58:18","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/get-week-days-list-in-magento-2-system-configuration\/"},"modified":"2025-07-16T17:51:55","modified_gmt":"2025-07-16T12:21:55","slug":"get-week-days-list-in-magento-2-system-configuration","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/get-week-days-list-in-magento-2-system-configuration\/","title":{"rendered":"How to Get Week Days List in Magento 2 System Configuration"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Magento 2\u00a0admin panel offers multiple input types such as text box, radio button, dropdown, multi-select boxes, etc. The input values of these fields are stored and displayed in different forms of grids, forms, fields, images, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sometimes, while developing&nbsp;<a href=\"https:\/\/meetanshi.com\/magento-2-extensions.html\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 extensions,&nbsp;<\/a>or custom features,&nbsp;developers often need to provide an option to choose days of the week to exclude or include in the module\u2019s functionalities.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, the feature for the admin to select the days of the week when a customer can book an appointment, or select the days on which the store will offer delivery.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Even when you want the store admin to monitor the days off as per the business requirements, the above solution is helpful.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In all these cases, you need to&nbsp;<em><strong>get week days list in Magento 2 system configuration<\/strong><\/em>&nbsp;as shown below:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-at-March-26th-2021-10.56.00-am.png\" alt=\"How to Get Week Days List in Magento 2 System Configuration\" class=\"wp-image-14725\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">If you face a similar requirement, feel free to use the below solution:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Get Week Days List in Magento 2 System Configuration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the below code in the&nbsp;<strong>system.xml<\/strong>&nbsp;at&nbsp;<strong>app\/code\/Meetanshi\/CustomerAppointment\/etc\/adminhtml<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;field id=\"week_days\" translate=\"label\" type=\"multiselect\" sortOrder=\"1\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n    &lt;label>Week day&lt;\/label>\n    &lt;source_model>Magento\\Config\\Model\\Config\\Source\\Locale\\Weekdays&lt;\/source_model>\n&lt;\/field><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Simple. Isn\u2019t it?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it to get the weekdays list in Magento 2 system configuration. You extensions can work expectedly if certain configurations are made to have particular values. For that you will need&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/set-default-values-for-magento-2-system-configuration\/\">magento 2 set default config value<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do share the solution with fellow developers via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2\u00a0admin panel offers multiple input types such as text box, radio button, dropdown, multi-select boxes, etc. The input values of these fields are stored&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1766","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1766"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1766\/revisions"}],"predecessor-version":[{"id":18082,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1766\/revisions\/18082"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}