Webkul
Services
Technologies Bagisto QloApps
iOS Android SAP BigCommerce Wix
Trusted by
Samsung Intel Toyota Walmart Disney Nokia Nestlé Decathlon
See all customers
Back to Top
DEV

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.

. . .

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