Aldi Thanks For Google and Stackoverflow.

Cara Mengubah Timestamp ke Date/tanggal di PHP

10 sec read

timestamp to date,timestamp to date php

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 *