Computing Magazine

Recreate Date and Time from a Timestamp in PHP

Posted on the 04 May 2012 by Akahgy

Description:

Reconstruct readable date and time from an integer timestamp.

Solution:

We have to use the date() function of PHP. The function takes a string containing the structure of the desired outputted date and the timestamp which we will use:

$readable_date = date(“d.m.Y H:i”, $timestamp_value);

echo $readable_date;

The function above will output something like: 04.05.2012  19:30 .


Back to Featured Articles on Logo Paperblog

Magazine