Re: [PHP-DB] MySQL date casting..

2006-01-17 Thread Philip Hallstrom
Forgive me that this isn't really PHP related, but solely MySQL.. but the MySQL mailing lists drive me nuts and figured someone here would have a quick answer. I'm trying to sort by a date and time field(s) (two separate fields). It's a dumb system but until we do the next revision, it's

RE: [PHP-DB] MySQL date casting..

2006-01-17 Thread tg-php
Unfortunately, no. The dates and times are stored as text. So here's what I get: 2006-01-10 07:00 PM 2006-01-10 08:00 PM 2006-01-10 09:00 AM 2006-01-10 09:00 PM (notice the AM out of order) For anyone interested, here's the big ugly version.. if anyone knows of a function that I can use

Re: [PHP-DB] MySQL date casting..

2006-01-17 Thread tg-php
Ahh! Thank you Philip! That's what I was looking for! I see what I did wrong now. I was using the date format strings wrong. I was using it like I'd use it for DATE_FORMAT() instead of as an input filter. This is what I was trying to do: select STR_TO_DATE('2003-11-05 06:00 PM', '%Y-%m-%d

Re: [PHP-DB] MySQL date casting..

2006-01-17 Thread Bastien Koert
Youcould also try CASTing (http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html) the data Bastien From: [EMAIL PROTECTED] To: php-db@lists.php.net CC: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL date casting.. Date: Tue, 17 Jan 2006 12:51:44 -0500 Ahh! Thank you Philip! That's