Tero

Convert UTC to Local

Apr 22nd, 2020
605
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.24 KB | None | 0 0
  1. function utclocal($date) {
  2.   $conv = new DateTime($date, new DateTimeZone('UTC'));
  3.   $conv->setTimeZone(new DateTimeZone('Europe/Bucharest'));
  4.   return $conv->format('Y-m-d H:i:s');
  5. }
  6. $date = '2020-04-22 14:00:00';
  7. echo utclocal($date);
Advertisement
Add Comment
Please, Sign In to add comment