Magento – Magento 2 – Problem with datetime attribute product

datemagento2product-attribute

In Magento2 : When I saved date attribute with time is the same picture below. After I saved it only save date and get no time.

Any know reason and how to fix it?
enter image description here

In database: after saved

enter image description here

When I changed format from \Magento\Framework\Stdlib\DateTime\Filter\Date to
\Magento\Framework\Stdlib\DateTime\Filter\DateTime and then I got:

Recoverable Error: Argument 7 passed to Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper::__construct() must be an instance of Magento\Framework\Stdlib\DateTime\Filter\DateTime, none given, called in
D:\xampp\htdocs\magento\var\generation\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\Interceptor.php on line 15 and defined in <br>
D:\xampp\htdocs\magento\vendor\magento\module-catalog\Con`troller\Adminhtml\Product\Initialization\Helper.php on line 57

Best Answer

Check your database whether your column is date type or date-time type.If it is date type then it only saves date not time but if your column type is of date-time then it saves date and time both.

Related Topic