SETting a datetime field based on a text field
am 29.09.2006 23:42:07 von unknownPost removed (X-No-Archive: yes)
Post removed (X-No-Archive: yes)
What's the structure of the table?
You could go...
UPDATE table SET newdatefield = STR_TO_DATE(olddatefield);
and then delete the string date field.
usenet@isotopeREEMOOVEmedia.com wrote:
> I've inherited a database which contains a column where datetimes are (stupidly)
> stored as text strings, like:
> September 29, 2006, 5:13 pm EDT
>
> The first thing I want to do is translate this column to a new one that properly
> uses datetime format. I can easily do it via PHP, but as a curiosity I thought
> I'd try to accomplish it in MySQL alone.
>
> It looks like STR_TO_DATE will do the trick, but can't come up with the correct
> MySQL 4.1.20 UPDATE syntax. Anyone have an idea?
>
> TIA
Post removed (X-No-Archive: yes)