[RESOLVED] Converting timestamps
In PHP4, I need to convert a Unix timestamp in the format '2008-10-21 00:00:00' to an integer timestamp that will work with date(). How do I do it?
EDIT: Right now I'm doing this:
but the date displayed is 31 Dec/69 instead of the correct date.
echo "<strong>".date('d M/y',$sitenews['date'])."</strong><br>\n"
Last edited by hex1a4; 10-21-2008 at 07:10 PM.
hmn, you need to rearange the early part of your number:
$dateAr1 = explode(' ', $sitenews['date']);
$dateAr2 = explode('-', $dateAr1);
$dateAr3 = explode(':', $dateAr1);
$timeStamp = mktime($dateAr3,$dateAr3, $dateAr3, $dateAr2, $dateAr2, $dateAr2);
echo "<strong>".date('d M/y',$timeStamp)."</strong><br>\n"
This did the trick. Thank you.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread