Does magento 2 support create new Datetime and set Timezone for it? I'm trying to create a new Datetime and set Timezone for it in magento 2 by following code but it's not a good way to do it because the validate code tool throws some warning. So is there any another way to do that in magento 2?. Thank for your help.
$fromDate = new \DateTime($dateFomat, new \DateTimeZone('UTC')); $fromDate = $fromDate->setTimezone(new \DateTimeZone(date_default_timezone_get()))->format('Y-m-d H:i:s');