SETting a datetime field based on a text field

SETting a datetime field based on a text field

am 29.09.2006 23:42:07 von unknown

Post removed (X-No-Archive: yes)

Re: SETting a datetime field based on a text field

am 02.10.2006 05:24:33 von peterloh

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

Re: SETting a datetime field based on a text field

am 02.10.2006 19:57:17 von unknown

Post removed (X-No-Archive: yes)