Aldi Thanks For Google and Stackoverflow.

Cara Mengubah Timestamp ke Date/tanggal di PHP

10 sec read

tips and trick min

Sedikit cara untuk mengubah timestamp ke date adalah dengan cara seperti dibawah ini :

<?php
$timestamp = 1615226965;
$datetimeFormat = ‘Y-m-d H:i:s’;

$date = new \DateTime();
//jika kamu ingin mengunakan sesuai zona
$date = new \DateTime(‘now’, new \DateTimeZone(‘Asia/Jakarta’));
$date->setTimestamp($timestamp);
echo $date->format($datetimeFormat);
?>

Aldi Thanks For Google and Stackoverflow.

Leave a Reply

Your email address will not be published. Required fields are marked *

×

Thank you for visiting this blog, don’t forget to comment here

 

ALDI
Aldi@index.my.id