Convert time from one timezone to another

Uses DateTime and DateTimeZone to convert time between timezones. Read more.

php
fork add to bundle source
function convert_timezone($date_time, $from_timezone, $to_timezone) { date_default_timezone_set($from_timezone); $dt = new DateTime($date_time); $dt->setTimezone( new DateTimeZone($to_timezone) ); return $dt->format('Y-m-d H:i:s'); }

usage

load_function('convert_timezone'); echo convert_timezone('2019-09-09 10:00:00', 'Europe/London', 'Asia/Bangkok'); // 2019-09-09 16:00:00
← how to use this in app?
create log ...inout