convert string into date

I wanted to convert a column whose data type of string into that of date.

First add a column with data type of date;

Then:

UPDATE `myTable` SET `REALDATE`= str_to_date( `SRTDATE` , '%m/%d/%Y' );

This will convert ’06/23/2007′ in STRDATE into ‘2007-06-23’ in REALDATE.

Advertisements

One Response to “convert string into date”

  1. vipin Says:

    i wnt exact code tht i didnt get

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: