Fix Error “date field value out of range” when using make_date() in PostgreSQL

If you’re getting an error that reads ‘date field value out of range‘ in PostgreSQL while using the make_date() function, it’s probably because one or more of the date parts you’re providing is out of range for that date part.

It’s possible that you’ve got the month and day in the wrong order.

To fix this issue, be sure that each date part you provide is within the valid range for that date part. It may be that all you need to do is switch the day and the month around.

Example of Error

Here’s an example of code that produces the error:

SELECT make_date(2025, 15, 09);

Result:

ERROR:  date field value out of range: 2025-15-09

Here I got the day and month in the wrong order, which would have produced an invalid date of 2025-15-09.

Solution

The solution is to use valid date parts. With make_date(), the first argument is for the year, the second argument is for the month, and the third is for the day.

In my case, I can simply switch the day and month around:

SELECT make_date(2025, 09, 15);

Result:

 make_date  
------------
2025-09-15

This time it worked without error.