how to change string into date in mysql

how to change string into date in mysql



//how to change string into date in mysql 
str_to_date(string_data, format)


  Example : 
  
  select *,floor(datediff(‘”.date(“Y-m-d”).”‘,str_to_date(‘dob’,’%d-%m-%Y’))/365) as agediff from tablename 
  
  dob = column name  and varchar type 
Advertisements

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