- time: documentation ( source)
- date: documentation ( source)
<?php
function formatDateMerchantTimeZone($t, $tz)
{
$date = new \DateTime($t, new \DateTimeZone('UTC'));
$date->setTimezone(new \DateTimeZone($tz));
return $date->format('Y-m-d H:i:s');
}
echo formatDateMerchantTimeZone(date('Y-m-d H:i:s', time()), 'utc');