4 Functions that Get the Week From a Date in DuckDB

Working with dates often requires extracting specific components, such as the week number, for analysis or reporting. In DuckDB, there are multiple functions to retrieve the week from a date, each catering to different needs. This article explores four such functions, including how to calculate the ISO week—a standard defined by ISO-8601 where weeks start on Monday and the first week of the year contains the year’s first Thursday.

Continue reading

Fix “Unrecognized format for strftime/strptime: %” in DuckDB

If you’re getting an error that includes the text “Unrecognized format for strftime/strptime: %” in DuckDB, it appears that you’re including an unescaped percent sign (%) in your format string when using a function like strftime() or strptime().

Whenever we need a percent sign to be included in the formatted output, we must escape it with another percent sign in the format string.

So to fix this issue, try escaping the percent sign with another percent sign.

Continue reading