-   Programming (
-   -   Convert Time String to DATETIME field (

Centinul 09-25-2006 08:10 PM

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


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

paulsm4 09-25-2006 08: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:

Centinul 09-25-2006 08:20 PM

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


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

All times are GMT -5. The time now is 11:28 PM.