RE: [PHP] mysql date question
| From: | Bastien Koert | Date: | Thu, 03 Jan 2008 14:51:59 +0000 |
| Subject: | RE: [PHP] mysql date question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266557@lists.php.net to get a copy of this message | ||
no need for quotes
select date_format(contract.length_start, '%m-%d-%Y') as length_start from contract where
user_id = 1;
bastien
> Date: Thu, 3 Jan 2008 08:30:55 -0600> From: awilliam@mdah.state.ms.us> To:
> php-general@lists.php.net> Subject: [PHP] mysql date question> > I have a field in mysql as
> shown by describe contract;> > | length_start | date | YES | | NULL > | |> > Which
> stores it in the mysql format of YYYY-MM-DD. However, I need the > output of my select statement
> to show it in MM-DD-YYYY format. I can > select it to see the date in the field:> > select
> length_start from contract where user_id = 1;> +--------------+> | length_start |>
> +--------------+> | 2006-01-12 |> +--------------+> 1 row in set (0.00 sec)> > so
> then I do my date_format() select statement, but it returns a NULL > value. Why?> > select
> date_format('contract.length_start', '%m-%d-%Y') as length_start > from
> contract where user_id = 1;> +--------------+> | length_start |> +--------------+> |
> NULL |> +--------------+> 1 row in set, 1 warning (0.00 sec)> > -- > PHP General
> Mailing List (http://www.php.net/)> To unsubscribe, visit:
> http://www.php.net/unsub.php>
_________________________________________________________________
Discover new ways to stay in touch with Windows Live! Visit the City @ Live today!
http://getyourliveid.ca/?icid=LIVEIDENCA006