Skip to content

Instantly share code, notes, and snippets.

@kylekatarnls
Last active January 30, 2019 12:58
Show Gist options
  • Save kylekatarnls/380246be4d99a86cfcddecc0097966c5 to your computer and use it in GitHub Desktop.
Save kylekatarnls/380246be4d99a86cfcddecc0097966c5 to your computer and use it in GitHub Desktop.

Revisions

  1. kylekatarnls revised this gist Jan 30, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion tokyo-to-utc.php
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    <?php
    $date = new DateTimeImmutable('2018-01-25T23:00:00 Asia/Tokyo');
    $dateString = rtrim($_POST['date'], 'Z');
    $date = new DateTimeImmutable("$dateString Asia/Tokyo");

    echo $date->setTimezone(new DateTimeZone('UTC'))->format('Y-m-d H:i:s.u');
  2. kylekatarnls created this gist Jan 30, 2019.
    4 changes: 4 additions & 0 deletions tokyo-to-utc.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    <?php
    $date = new DateTimeImmutable('2018-01-25T23:00:00 Asia/Tokyo');

    echo $date->setTimezone(new DateTimeZone('UTC'))->format('Y-m-d H:i:s.u');