Answers for "php convert str datetime to timezone"

PHP
1

convert one time zone datetime value to another using php

<?php
$date = new DateTime('2000-01-01', new DateTimeZone('Pacific/Nauru'));
echo $date->format('Y-m-d H:i:sP') . "\n";

$date->setTimezone(new DateTimeZone('Pacific/Chatham'));
echo $date->format('Y-m-d H:i:sP') . "\n";
?>
  
  2000-01-01 00:00:00+12:00
2000-01-01 01:45:00+13:45
Posted by: Guest on December-31-2020
0

PHP DateTime Format date time according to a time zone

$date = new \DateTime($his['DATE_TIME']);
															$date->setTimezone(new \DateTimeZone('Asia/Karachi')); 
															echo $date->format('F j, Y, g:i a');
Posted by: Guest on December-20-2021

Code answers related to "php convert str datetime to timezone"

Browse Popular Code Answers by Language