reversing a date stamp
| From: | mike karthauser | Date: | Thu, 05 Dec 2002 17:37:32 +0000 |
| Subject: | reversing a date stamp | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-23841@lists.php.net to get a copy of this message | ||
I'm using the below code as the basis for a client updateable news section..
I have variable called date which is set in the db as TIMESTAMP(6). When I
print it i get the date in the reverse order YYMMDD. What would be the best
way to display it in reverse based on my code below?
Thanks..
<snip>
$result = mysql_query("SELECT * FROM news",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("<strong>%s</strong><br>\n", $myrow["title"]);
printf("%s <a href=\"%s?id=%s\" class=\"mailto\">more
>></a> [%s]<p>\n",
$myrow["summary"], $_SERVER['PHP_SELF'], $myrow["id"],
$myrow["date"]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "<p>Sorry, no records were found!";
}
</snip>
--
Mike Karthauser
Managing Director - Brightstorm Ltd
Email >> mikek@brightstorm.co.uk
Web >> http://www.brightstorm.co.uk
Tel >> 0117 9426653 (office)
07939 252144 (mobile)
Snailmail >> Unit 8, 14 King Square,
Bristol BS2 8JJ