rexrony89

Time Zone Conversion

Sep 26th, 2020
1,155
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. date_default_timezone_set('Asia/Karachi');
  4. $datetime = new DateTime('2020-09-27 01:47:23');
  5. echo "Pakistan = ".$datetime->format('Y-m-d H:i:s A')."\n<br><br>";
  6. $la_time = new DateTimeZone('America/Los_Angeles');
  7. $datetime->setTimezone($la_time);
  8. echo "Los_Angeles = ".$datetime->format('Y-m-d H:i:s A')."<br><br><br>";
  9.  
  10.  
  11. $currentDateTime = '08/04/2010 22:15:00';
  12. echo $newDateTime = date('h:i A', strtotime($currentDateTime))."<br><br><br>";
  13.  
  14.  
  15. print gmdate("Y-m-d\TH:i:s\Z");
  16.  
  17. ?>
RAW Paste Data