LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Convert Time String to DATETIME field (http://www.linuxquestions.org/questions/programming-9/convert-time-string-to-datetime-field-486930/)

Centinul 09-25-2006 07:10 PM

Convert Time String to DATETIME field
 
What is the best way to convert a time like this:

Code:

Sep 21 12:34:56 2006
To something that MySQL can understand like a DATETIME field? Thanks.

paulsm4 09-25-2006 07:16 PM

Actually, you've a got a whole BUNCH of different options. Especially if you're calling MySQL from PHP.

Anyway, here's a good place to start:
http://dev.mysql.com/doc/refman/5.0/...functions.html

Centinul 09-25-2006 07:20 PM

Thanks for the reference. Here is what I ended up using:

Code:

str_to_date('Sep 21 12:34:56 2006','%b %e %T %Y')
Thanks again :)


All times are GMT -5. The time now is 08:02 AM.