img how to create Date and Time Setting in System.xml in magento
Sometimes Magento Store owners require setting date and time in Magento backend to show countdown timer in frontend or run a cron on a specific frequency. Recently, while working on a custom development project, we came across with a requirement to add custom date and time picker in the Magento admin configuration page that let store owners easily pick their convenient date and time and making selections as per need. There is no direct method that can be called to add the date picker in Magento. Here, I’m sharing simple code to fulfill the requirement.
To add date & time picker, first of all you need to create date.php file at following location in your custom extension
[Vendor]\[ModuleName]\ Block\Adminhtml\System\Config
After creating file, you need to add the following code.
As shown above, there are four different types of format exists that you can use as per your convenience in Magento.
Once you have created date.php file, you have to add below code in System.xml file.
notificationbar/adminhtml_system_config_date 150 1 1 1 time 152 1 1 1
Once you add both the code in the right place, refresh your admin configuration page and your date picker will start displaying at the position you have placed. Simply change the code according to your requirements and test again. I hope this code has helped you! Rate the blog and comment down below if you are looking for any help regarding this code.
Cheers!
Hello Magento Friends, In this blog, we will discuss about adding quantity increment and decrement…
In this guide, we'll explore how to integrate ChatGPT, an AI-powered chatbot, with a Laravel…
In the world of business, understanding financial metrics is crucial for making informed decisions and…
Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…
In this era, businesses are always on the lookout for ways to engage with their…
Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…