Maybe I'm not thinking logically about this. I have a date and time which I want to convert to a UTC timestamp. This date and time are in an array of timezones.

So for example, I have 15 May 2019 15:45 (Singapore) and 15 May 2019 07:45 Los Angeles.

I want to convert these to the UTC time as at the time it was when these locations were at this time and store this unix timestamp.

So I have converted the date and time via strtotime, I've changed timezones and can echo out the UTC time correctly but can't get the timestamp of this.

date_default_timezone_set("Pacific/Auckland");
$Local = strtotime('22-05-2019 23:55');
echo $Local . "<br>";
echo date('d m Y H:i', $Local) .'<hr>';


date_default_timezone_set("UTC");
echo(date("Y-d-m TG:i:sz", $Local) . "<br />"); 
$S = strtotime(date('d-m-Y H:i', $Local));
echo $S;

    http://www.php.net/datetime.settimezone
    Obviously you'd use "Asia/Singapore"/"America/Los_Angeles" and "UTC" instead of "Pacific/Nauru" and "Pacific/Chatham".

    Unix timestamps are always UTC. See the top user comment on the linked page.

      okay, looking to use a date time option now. I have my server setting, let's assume that's in Australia. I have a date time which I know it UK time, but I want the UTC time of that.

      How?

      $tz = new DateTimeZone('Europe/London');
      
      $date = new DateTime('2019-05-22 16:59');
      $date->setTimezone($tz);
      echo $date->format('Y-m-d h:i:s')."\n";
      
        Write a Reply...