Updating attributes in Magento 2

Today we have faced some issues while working on updating the attributes in Magento.

Magento2: Use default for product attributes in bulk updates
If we had set ‘New From Date’ and ‘New To Date’ to an incorrect value in store view level, But later to set the correct value In default config is a hectic to set them So for each product by clicking the checkbox to ‘use default’ value. Have done the same for all the products by using the below script which updates them altogether.

To check the use default for all the products we need to run the below program.