php - How can I convert String to Date in phpMyAdmin? -


i'm web designer, new php/sql/phpmyadmin, learning fast.

i have imported data column "entry_date" in following incorrect format: (mm/dd/yyyy) need converted correct date format/type.

i have set 2 columns
1) entry_date - char(10)
2) new_date - date

in phpmysql, int mytable's "sql" tab, ran;

update mytable(new_date) select str_to_date(entry_date,'%m/%d/%y') date `mytable`; 

i confirmed select str_to_date line converting string date, not able values update new_date column (which populatred "0000-00-00". missing?

try this

   select str_to_date(entry_date,'%y-%m-%d')  `mytable`; 

or this

  select date_format(entry_date,'%y-%m-%d')  `mytable`;  

edit:

  update mytable set new_date = date(date_format(entry_date,'%y-%m-%d')) ; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -