How to add a date/time product attribute to Magento admin

Adding a date attribute to Magento is no problem – but what about date + time? In this article I’ll explain how to add a date/time product attribute to Magento admin programmatically with upgrade script. Basically to make it happen you need to configure the renderer for date field and source model to convert the date and save time as well as date.

So let’s start with renderer itself:


Next – let’s create a source model that will handle this attribute on save:


And finally the upgrade script to create an attribute and connect it to model and renderer:


You can use any setup options for you attribute, but the most important part here is:

and That’s it folks. Hope that helps.


How to add a date/time product attribute to Magento admin
4.8 (95%) 4 vote[s]

Comments (6)

  1. I added the as described, but the datepicker still rest the same with only the date…
    I use magento

    • Do you see your custom attribute in attribute set? Just to make it clear – this will not change every datepicker in admin to display time – this will work only for the brand new added attribute.

  2. Hello,
    I added the as described, but i’ve got an error :
    Fatal error: Class ‘Mage_MyCompagny_MyModule_Checkout_Block_Adminhtml_Renderer_Datetime’ not found in …\lib\Varien\Data\Form\Abstract.php on line 144
    An Idea ?
    I use magento

  3. Hey Igor,

    I’m looking to change the default special date from and to, to include the time option too. Any idea how to do that?


What do you think?

Required fields are marked *