PHP: Convert Local Time to UTC

前端 未结 2 933
忘掉有多难
忘掉有多难 2021-01-22 18:30

Assume I get a string like 08/22/2015 10:56 PM and that this date/time string always refers to only one particular time zone. I need to be able to convert that to t

2条回答
  •  盖世英雄少女心
    2021-01-22 19:23

    You can use DateTime, example bellow:

    setTimeZone(new DateTimeZone($tz_to));
    echo $dt->format($format) . "\n";
    
    $minutes = 30;
    $dt->add(new DateInterval('PT' . $minutes . 'M'));
    echo $dt->format($format) . "\n";
    

提交回复
热议问题