SOLVED:Re: [PHP] timestamp to readabe date and time ?
| From: | Damian Brown | Date: | Sun, 11 Apr 2004 06:19:28 +0000 |
| Subject: | SOLVED:Re: [PHP] timestamp to readabe date and time ? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183115@lists.php.net to get a copy of this message | ||
problem was solved by using substr() on the timestamp
--
www.phpexpert.org/truefaith.htm
"True Faith is not just when you believe in God and yourself, it is when
others begin to believe in you as well" - Damian John Paul Brown 2004
"Damian Brown" <damian@phpexpert.org> wrote in message
news:20040411022733.90119.qmail@pb1.pair.com...
> Thank Yoy Ryan
>
> I had thought the same, but I didn't know how to go about it
> I did not know of the substr function
> it is now outputting as follows
>
> 10 04 2004 - 21:23:50
>
> Thanks once again, I am sure I will be asking for more help soon
> I tend to dive in at the deep end and never learn the basics
> --
> www.phpexpert.org/truefaith.htm
> "True Faith is not just when you believe in God and yourself, it is when
> others begin to believe in you as well" - Damian John Paul Brown 2004
> "Ryan A" <ryan@coinpass.com> wrote in message
> news:000301c41f64$e922f730$f081aa51@l2zcaxu7emppqh...
> >
> > 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