My magento2 site date format is no like a MM/DD/YY format but I want to change DD/MM/YY format in my orders page and all other date fields. Please help me I tried and changed configuration settings JavaScript calendar but no changes in dates. Please help me by changing programmatically.


You can change the date format by using the following code.

protected $timezone;

public function __construct(
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone,
    $this->timezone = $timezone;

$dateTimeZone = $this->timezone->date(new \DateTime($yourdate))->format('Y/m/d H:i:s');
  • Where do I add this code? – Jay Aug 19 '19 at 4:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.