View Single Post
Old 01-11-2011, 05:23 AM  
Traxman
Registered User
 
Industry Role:
Join Date: Dec 2010
Location: Close to internet
Posts: 58
Quote:
Originally Posted by Angry Jew Cat View Post
Even better. That's more what I was looking for. I knew there had to be some way to handle it as a part of the insertion process. Would there be any reason to lean one way or the either between STR_TO_DATE in the insertion vs explode() and then inserting the value?
Always let mysql do the job for you, reading a line and splitting into a variable and then put that variable directly into mysql with str_to_date is better than you are doing it,
even if you can ofcus, why reinventing the wheel ?

if you feel unsure about the functions, simple queries against mysql as example:
mysql> SELECT STR_TO_DATE('1/12/2011', '%e/%m/%Y');
+--------------------------------------+
| STR_TO_DATE('1/12/2011', '%e/%m/%Y') |
+--------------------------------------+
| 2011-12-01 |
+--------------------------------------+
1 row in set (0.00 sec)

Then you always can see how things will look like and you will learn a lot more about
mysql functions.
__________________
Just because I know a lot of things, dont mean I know everything
Traxman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote