Back to Top

How To Convert Date According To Locale Magento 2

Updated 16 July 2021

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.

Searching for an experienced
Magento 2 Company ?
Find out More
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home