How to Get Day Names in PostgreSQL Database: PostgreSQL Operators: to_char() date LC_TIME Problem: You want to extract the day of the week from a date in PostgreSQL. Solution 1: To extract the day name from the date, you can use the to_char() function. The first parameter is the date and the second is the desired output format. To extract the full day name, the format should be ‘Day’ : SELECT to_char(date '2022-01-01', 'Day'); The result is ‘Saturday’. Discussion: This is not the only format you can use to extract the day name. Here are some alternatives: ‘DAY’ would return an uppercase name (‘SATURDAY’) ‘day’ would return a lowercase name (‘saturday’) ‘DY’ would return ‘SAT’ ‘Dy’ would return ‘Sat’ ‘dy’ would return ‘sat’ You can also extract the day name in other languages. Two adjustments are required to do this: Setting new locale for times and dates using SET lc_time; Using the ‘TMDay’ format to enable translation based on lc_time. Let’s look at an example. Solution 2: Let’s extract the day name in German: set lc_time = 'de_DE'; select to_char(date '2022-01-01', 'TMDay') ; The result is ‘Samstag’. Recommended courses: Recommended articles: Performing Calculations on Date- and Time-Related Values SQL Date and Time Functions in 5 Popular SQL Dialects See also: How to Convert a String to a Date in PostgreSQL How to Extract the Week Number from a Date in PostgreSQL How to Get the Day of the Year from a Date in PostgreSQL Subscribe to our newsletter Join our monthly newsletter to be notified about the latest posts. Email address How Do You Write a SELECT Statement in SQL? What Is a Foreign Key in SQL? Enumerate and Explain All the Basic Elements of an SQL Query