I tried to create an attribute for product which has to be display date and time calender and that should be stored in database as date and time formate only.I struggled it for a lot but no luck.Can you please any one help me..
this is my script
$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
'xyz_start_time',
[
'group' => 'xyz',
'type' => 'datetime',
'backend' => '',
'frontend' => '',
'label' => 'Start Time',
'input' => 'date',
'class' => '',
'source' => '',
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => 'simple,configurable,virtual,bundle,downloadable'
]
);
$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
'xyz_end_time',
[
'group' => 'xyz',
'type' => 'datetime',
'backend' => '',
'frontend' => '',
'label' => 'End Time',
'input' => 'date',
'class' => '',
'source' => '',
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => 'simple,configurable,virtual,bundle,downloadable'
]
);
It is creating datepicker with date only not showing time on it.