convert one time zone datetime value to another using php

Solutions on MaxInterview for convert one time zone datetime value to another using php by the best coders in the world

showing results for - "convert one time zone datetime value to another using php"
Lara
30 Jan 2021
1<?php
2$date = new DateTime('2000-01-01', new DateTimeZone('Pacific/Nauru'));
3echo $date->format('Y-m-d H:i:sP') . "\n";
4
5$date->setTimezone(new DateTimeZone('Pacific/Chatham'));
6echo $date->format('Y-m-d H:i:sP') . "\n";
7?>
8  
9  2000-01-01 00:00:00+12:00
102000-01-01 01:45:00+13:45