How to use to_char function in Oracle

You will use the below SQL to use to_char function correctly.

select first_name, last_name,
to_char(hire_date, 'Day, Month DDTH, YYYY') formatted_hire_date
from hr.employees;

Results from our TO_CHAR formatting appear with the correct day name, month name and other desired formatting in place.
FIRST_NAME            LAST_NAME       FORMATTED_ HIRE_DATE
-------------------   -----------     --------------------
Donald                OConnell       Monday,June 21ST, 1999
Douglas               Grant          Thursday,January   13TH, 2000
Jennifer              Whalen         Thursday,September 17TH, 1987
Michael               Hartstein      Saturday,February  17TH, 1996
Pat                   Fay            Sunday,August    17TH, 1997

Comments

Popular posts from this blog

Top myths for NULL value in SQL Queries