How To Convert Date According To Locale Magento 2

How To Convert Date According To Locale Magento 2 : Sometime we need date also according to locale. so here is way through which you can change the date according to the locale.

 

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

$customDate = $objectManager->create('Magento\Framework\Stdlib\DateTime\TimezoneInterface'
               )->formatDate(
                        $date,
                        \IntlDateFormatter::FULL,
                        false
               );

$customDate variable contain date according to locale.

. . .

Ask a Feature