Magento 2 convert date to timestamp using best practice.

Magento 2 You can Converts input date into GMT timestamp using Magento\Framework\Stdlib\DateTime\DateTime Class.

You can set easily convert timestamp using core PHP by function strtotime().
like, strtotime(‘+1 years’);

Using Magento You can Converts input date into GMT timestamp by using Magento best practice way by injecting class dependency in the construct method. Continue reading “Magento 2 convert date to timestamp using best practice.”

Magento 2 Get Date after 1 year period.

Magento 2 you can get a date after 1 year period using Magento\Framework\Stdlib\DateTime\DateTime Class.

You can get easily using PHP by function date().
date(‘Y-m-d’, strtotime(‘+1 years’));

Using Magento You can get a date after 1 year by using Magento best practice way by injecting class dependency in the construct method. Continue reading “Magento 2 Get Date after 1 year period.”

Magento 2 Create Custom Category Widget.

In Magento 2, There are many default widgets available in native.
You can check the list of the widget from Magento Opensource by Admin panel.

Go To Content -> Elements -> Widgets

Name of widgets which are an available default,
CMS Page link, CMS Static Block, Catalog Category Link, Catalog New Products List, Catalog Product Link, Catalog Products List, Orders and Returns, Recently Compared Products, Recently Viewed Products Continue reading “Magento 2 Create Custom Category Widget.”