Jump to content

display date readable


aebstract

Recommended Posts

That is what I have, but it is just displaying: 01/15/2008 for every value, but every row in the db has a different value for date_created.

 

Then there's a problem with how you're retrieving the data. show us some more complete code

Link to comment
Share on other sites

$result = mysql_query("SELECT * FROM albums ORDER BY id ASC") or DIE(mysql_error());
while($r=mysql_fetch_array($result))
{

$id=$r["id"];
$superid=$r["superid"];
$date_created=$r["date_created"];
$date_modified=$r["date_modified"];
$title=$r["title"];
$bg_color=$r["bg_color"];

echo "<li><a href=\"index.php?page=edit&edit=$superid\">edit</a> | <a href=\"index.php?page=album&album=$superid\">$title</a></li>";
$date_created_readable = date('m/d/Y', $date_created);
echo "$date_created_readable";

}

 

and when I echo the date_created, it displays a unique timestamp for each result..

Link to comment
Share on other sites

Yes, it appears most are on the same day.

 

<?php

$str = '1200594207
1200435878
1200435906
1200435913
1200435925
1200435930';

foreach (explode("\n", $str) as $stamp)
echo date ('m/d/Y h:i:s', $stamp) . '<br>';

?>

 

Returns

 

01/17/2008 10:23:27
01/15/2008 02:24:38
01/15/2008 02:25:06
01/15/2008 02:25:13
01/15/2008 02:25:25
01/15/2008 02:25:30

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.