We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

You can try below code to change local date to UTC date.

<?php
namespace MagemonkeyUtcDateModel;

use MagentoFrameworkStdlibDateTimeTimezoneLocalizedDateToUtcConverterInterface;

class UtcDate
{
    /**
     * @var LocalizedDateToUtcConverterInterface
     */
    private $localtoutc;

    public function __construct(
        LocalizedDateToUtcConverterInterface $localtoutc
    ) {
        $this->localtoutc = $localtoutc;
    }

    /**
     * convert UTC Date
     *
     * @return string
     */
    public function convertUTCdate(): string
    {
        $localDate = date('m-d-Y');
        return $this->localtoutc->convertLocalizedDateToUtc($localDate);
    }
}

 

Fill the below form if you need any Magento relate help/advise/consulting.

With Only Agency that provides a 24/7 emergency support.

    Recent Articles
    Get a Free Quote

      Full Name

      Email Address

      Mobile Number

      Message

      Let’s initiate a discussion!!

      With Only Agency that provides a 24/7 emergency support.

        Full Name

        Email Address

        Mobile Number

        Message