Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    magento-hyperlocal-marketplace-guide

    Convert Date According to Specific Locale Magento 2

    Convert Date According to Specific Locale Magento 2 : Today we will learn how to convert a date to a specific locale.
    So magento has an interface DateTimeFormatterInterface, through which we can convert a date to any other locale according to our need.
    check the below code.

     


    So convertedDate variable contains translated and localized date string.

    Hope so it will help.

    . . .

    Comments (2)

    Add Your Comment

  • Erfan
    $testPro is meant to be $dateTimeFormatter I assume?
    • ashutosh srivastava
      yes Erfan that was a mistake I have updated it in the blog, thanks
  • Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close