Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converting UTC to Local Time PHP
<?php
//Standart waktu di Indonesia
date_default_timezone_set('Asia/Jakarta');
//Contoh Variable Waktu dengan format UTC
$timeutc = "2018-09-17T00:20:00Z";
//CONVERT UTC TO LOKAL dengan format tgl/bln/thn jam:menit:detik
$time1 = strtotime($timeutc.' UTC');
$format1 = date("Y-m-d H:i:s", $time1);
//CONVERT UTC TO LOKAL dengan format hanya jam:menit:detik
$time2 = strtotime($timeutc.' UTC');
$format2 = date("H:i:s", $time2);
echo "Contoh Konversi 1 : $format1 <br> Contoh Konversi 2 : $format2";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment