Re: date()
| From: | Jason Wong | Date: | Wed, 13 Nov 2002 21:12:19 +0000 |
| Subject: | Re: date() | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23312@lists.php.net to get a copy of this message | ||
On Thursday 14 November 2002 05:27, Edward Peloke wrote:
> I have a date field in my mysql db, when I output the data to the screen, I
> don't want to see the minutes, just the mmddyy.
DATE fields in MySQL don't have the time (h:m:s).
> I can format a date but
> can't seem to get it to work passing in the value from
> $myrow["datefield"]....any ideas? I don't want to have to worry about just
> pulling what I want in the select clause, I just want to format it when I
> diplay it.
If you're pulling the dates from the db and just using it purely for display
then you may as well use DATE_FORMAT() on them in your query:
..., DATE_FORMAT(...) AS datefield, ...
where datefield is the name of your column holding the date.
If you're doing calculations on your dates in your PHP code then you should
convert them using UNIX_TIMESTAMP() in your query.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Only through hard work and perseverance can one truly suffer.
*/