Re: timestamp to readabe date and time ?
| From: | Ryan A | Date: | Sun, 11 Apr 2004 01:32:52 +0000 |
| Subject: | Re: timestamp to readabe date and time ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-183098@lists.php.net to get a copy of this message | ||
On 4/11/2004 3:25:09 AM, Damian Brown (damian@phpexpert.org) wrote:
> I need to output a date and time that shows more clearly than just
> outputting the timestamp
>
> what is the correct way to go about it ?
> I have looked at getdate(), but I haven't fathomed it out yet !
If you are using timestamp(14), here is how i do it: (after the select)
if(($row = mysql_fetch_row($result))>=1)
{
$d_year = substr($row[4],0,4);
$d_month = substr($row[4],4,2);
$d_day = substr($row[4],6,2);
$d_hours = substr($row[4],8,2);
$d_mins = substr($row[4],10,2);
$d_secs = substr($row[4],12,2);
}
I am using a mysql_fetch_row as i am getting a lot of fields from the db,
you may want to use the fetch_array or something else but eh above should
give you an idea. The reason I like it like this is because the
year,month,date etc is all in different varialbes which I can format the way
I want it...or can even give the client the option of specifying the
format...but thats another thing altogether....
HTH.
Cheers,
-Ryan