Skip to content
Advertisement

Change the format of joining date to month-day,year sql

Change the format of joining date to month-day,year for e.g. January 31,1992.

Query

select ename, to_char(joining_date,'Month DD,YYYY.') from emp_demo ;

Error

 'to_char' is not a recognized built-in function name.

Table emp_demo format

joining_date
1992-01-31

Advertisement

Answer

You seem to be looking to display your date in a given format (which is what to_char() does in Oracle).

In SQL Server, you can use format():

select ename, format(joining_date, 'MMMM dd,yyyy.')

Demo on DB Fiddle:

select format(getdate(),'MMMM dd,yyyy.')

Yields:

May 04,2020.
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement