Re: Date() Problem
| From: | JJ Harrison | Date: | Sat, 27 Jul 2002 11:11:15 +0000 |
| Subject: | Re: Date() Problem | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109954@lists.php.net to get a copy of this message | ||
Alternativly you could store the dates as UNIX timestamps.
That is what I do. It is then eaiser to do certian things(ie show stuff
released in the last month)
--
JJ Harrison
webmaster@tececo.com
www.tececo.com
"Tony Harrison" <tonyh21@tharrison21.fsnet.co.uk> wrote in message
news:20020727093802.11015.qmail@pb1.pair.com...
> Yeh, ive allready looked at that before, but where and when do i use
> DATE_FORMAT() ? When im inserting the row or selecting it?
>
> "Jome" <jome@emoj.net> wrote in message
> news:20020727093525.8534.qmail@pb1.pair.com...
> > > Hi, im making a tab/lyric portal, and for viewing tabs i want to
display
> > the
> > > time the lyric/tab was submitted. So I retrive it from a MySQL
database
> > (as
> > > a timestamp) and format it using the date function. The problem is,
that
> > the
> > > date: 19-01-2038 04:14:07 is allways returned, even though in the
date
> > > field the timestamp says (as an actual example) 20020723200919.
> > >
> > > Here is a shortened version of the script:
> > >
> > > <?php $submitdate = date("d-m-Y H:i:s", $values[4]);
> > > echo("Submitted
on
> > > $submitdate"); ?>
> > >
> >
> > Hi Tony,
> >
> > the date() function in PHP does _only_ take UNIX timestamps as an
argument
> > which means that you can not run such a timestamp as the above.
> >
> > I recommend that you have a look at
> > http://www.mysql.com/doc/D/a/Date_and_time_functions.html
> > which
describes
> > the built-in functions for date-handling in MySQL. A function to look at
> > could be DATE_FORMAT().
> >
> > Regards,
> >
> > Jome
> >
> >
>
>