Menu Close
    Hire us Request quote Reading list Switch to dark mode
    lockdownWebkulUp

    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.

    . . .
    Subscribe Articles

    Just enter your email below to subscribe and receive weekly updates about the most interesting similar articles.

    You need to accept conditions to receive letters.
    You've Subscribed!

    Share article via

    . . .

    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