Saturday, February 11, 2012

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 

No comments:

Post a Comment

If you Satisfied , Please Leave a comment