Re: MySQL timestamp to desired date function

From: Date: Thu, 18 Sep 2003 11:39:04 +0000
Subject: Re: MySQL timestamp to desired date function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162989@lists.php.net to get a copy of this message
In article <001001c37d9e$c8d78c60$0300a8c0@notebook>, lists@icaam.com.ar says... > Hi all, > > I have a a timestamp in a DB (14 digits) that I want to display like I > want in my pages. I tried to use strtotime, mktime and date functions > with no success... it always return the current timestamp instead of the > one I have stored. This is what I've done so far: > > for ($x = 0; $x < $num_rows; $x++) > { > $row = mysql_fetch_array($result); > $date1 = strtotime($row[lugar_lastinsert]); > $date2 = date("d \de m \de Y \a \l\a\s H:i:s", > mktime($date1)); > echo "<tr>"; > echo "<td>"; > echo $row[lugar_name]." - ".$row[lugar_specific]; > echo "</td>"; > echo "<td align=\"center\">"; > echo $date2; > echo "</td>"; > echo "</tr>"; > } > > How can I do this and make it work? > > Thanks in advanced, > > Cesar Aracena > www.icaam.com.ar > Have you considered using MySQL's DATE_FORMAT function? Cheers -- Quod subigo farinam A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet?

« previous php.general (#162989) next »