How to get Current GMT date time in Magento 2?

How to retrieve GMT Date Time from Magento 2?

Magento native supports DateTime PHP class, Magento\Framework\Stdlib\DateTime\DateTime is used for forms GMT date.

Magento provides GMT timezone by using the given function in the code snippet.

public function __construct(\Magento\Framework\Stdlib\DateTime\DateTimeFactory $dateTimeFactory)
    $this->dateTimeFactory = $dateTimeFactory;

Call the above function at the required place and your work is done,

$dateModel = $this->dateTimeFactory->create();
echo $dateModel->gmtDate();

First Parameter is optional $format = null in gmtDate()
The default Format is Y-m-d H:i:s, You can add your time zone to convert the normal timezone to GMT Timezone.

Result: 2023-04-03 11:22:49