Home > Archive > PHP DB > January 2006 > Re: [PHP-DB] MySQL date casting..
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PHP-DB] MySQL date casting..
|
|
| tg-php@gryffyndevelopment.com 2006-01-17, 6:57 pm |
| 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 %H:%i:%s')
duh... hah. Thanks! I knew it was something simple.
-TG
------------------
What's wrong with [using] this?
mysql> select str_to_date('2005-10-27 07:00 PM', '%Y-%m-%d %l:%i %p');
+---------------------------------------------------------+
| str_to_date('2005-10-27 07:00 PM', '%Y-%m-%d %l:%i %p') |
+---------------------------------------------------------+
| 2005-10-27 19:00:00 |
+---------------------------------------------------------+
1 row in set (0.04 sec)
________________________________________
___________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
| |
| Bastien Koert 2006-01-17, 6:57 pm |
|
Youcould also try CASTing
(http://dev.mysql.com/doc/refman/5.0...-functions.html) the data
Bastien
>From: <tg-php@gryffyndevelopment.com>
>To: <php-db@lists.php.net>
>CC: <php@philip.pjkh.com>
>Subject: Re: [PHP-DB] MySQL date casting..
>Date: Tue, 17 Jan 2006 12:51:44 -0500
>
>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 %H:%i:%s')
>
>
>duh... hah. Thanks! I knew it was something simple.
>
>-TG
>
>------------------
>What's wrong with [using] this?
>
>mysql> select str_to_date('2005-10-27 07:00 PM', '%Y-%m-%d %l:%i %p');
>+---------------------------------------------------------+
>| str_to_date('2005-10-27 07:00 PM', '%Y-%m-%d %l:%i %p') |
>+---------------------------------------------------------+
>| 2005-10-27 19:00:00 |
>+---------------------------------------------------------+
>1 row in set (0.04 sec)
>
>
>
> ________________________________________
___________________
>Sent by ePrompter, the premier email notification software.
>Free download at http://www.ePrompter.com.
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
|
|
|
|
|