i am getting DATE_FORMAT error in ruby on rails with sql server as a database
<% date = Date.today %>
<% @employees = Employee.where("status = ? AND DATE_FORMAT(date_of_birth,'%d/%m') = ?", "Active" , date.strftime('%d/%m')) %>
i am getting DATE_FORMAT error in ruby on rails with sql server as a database
<% date = Date.today %>
<% @employees = Employee.where("status = ? AND DATE_FORMAT(date_of_birth,'%d/%m') = ?", "Active" , date.strftime('%d/%m')) %>
Try this,
<% date = Date.today %>
<% @employees = Employee.where("status = ? AND FORMAT(date_of_birth,'dd/MM','en-US') = ?", "Active" , date.strftime('%d/%m')) %>
Learn more about Format function