RE: [PHP] MySQL timestamp to desired date function

From: Date: Thu, 18 Sep 2003 04:53:53 +0000
Subject: RE: [PHP] MySQL timestamp to desired date function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162952@lists.php.net to get a copy of this message
Thanks Tom, but using only the strtotime() and later the date() functions, the page throus the following error: Warning: unexpected error in date() in e:\wwwroot\videoteca\index.php on line 52 Now my code looks like this: $date1 = strtotime($row[lugar_lastinsert]); $date2 = date("d \de m \de Y H:i:s", $date1); Any ideas? Thanks, Cesar Aracena www.icaam.com.ar -----Mensaje original----- De: Tom Rogers [mailto:trogers@kwikin.com] Enviado el: Jueves, 18 de Septiembre de 2003 01:48 a.m. Para: Cesar Aracena CC: php-general@lists.php.net Asunto: Re: [PHP] MySQL timestamp to desired date function Hi, Thursday, September 18, 2003, 2:38:50 PM, you wrote: CA> Hi all, CA> I have a a timestamp in a DB (14 digits) that I want to display like I CA> want in my pages. I tried to use strtotime, mktime and date functions CA> with no success... it always return the current timestamp instead of the CA> one I have stored. This is what I've done so far: CA> for ($x = 0; $x < $num_rows; $x++) CA> { CA> $row = mysql_fetch_array($result); CA> $date1 = strtotime($row[lugar_lastinsert]); CA> $date2 = date("d \de m \de Y \a \l\a\s H:i:s", CA> mktime($date1)); CA> echo "<tr>"; CA> echo "<td>"; CA> echo $row[lugar_name]." - ".$row[lugar_specific]; CA> echo "</td>"; CA> echo "<td align=\"center\">"; CA> echo $date2; CA> echo "</td>"; CA> echo "</tr>"; CA> } CA> How can I do this and make it work? CA> Thanks in advanced, CA> Cesar Aracena CA> www.icaam.com.ar strtotime() returns a timestamp so you don't need the mktime() call $date2 = date("d \de m \de Y \a \l\a\s H:i:s", $date1); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#162952) next »