I am trying to execute following built-in function in sql but it gives me error that this function doesn’t exist
my query:
select EmpId, EmpName, format(EmpJoinDate, "YYYY-DD-MM") as date from Employee
Error i am getting:
'format' is not a recognized built-in function name
What may be the problem, or what am i doing wrong?
Thanks!
Advertisement
Answer
Use Convert
function instead. Example:
select convert(varchar(5), GETDATE(), 126) + convert(varchar(5), GETDATE(), 105)