How to convert date according to specific locale in Magento 2?

Sometimes we need to convert date formate to locale. We can use \Magento\Framework\Stdlib\DateTime\TimezoneInterface class to convert dare according to locale. Using Object Manager: $date = new \DateTime('2019-11-21'); $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $formatDate = $objectManager->create('Magento\Framework\Stdlib\DateTime\TimezoneInterface') ->formatDate( $date, \IntlDateFormatter::FULL, false ); Using Dependency Injection: namespace MagePrince\Testing\Model; class FormatDatLocale { private $timezoneInterface; public function __construct( \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezoneInterface ) {…

Continue Reading How to convert date according to specific locale in Magento 2?