2 Ways to Get the Month Name from a Date in DuckDB

DuckDB offers a pretty good range of functions that enable us to get date parts from date or timestamp value. For example, we can extract the month part from a given date value. In most cases, this will be the month number, for example 08 or just 8.

But sometimes we might want to get the actual month name, like October for example. And other times we might just want the abbreviated month name, like Oct.

Fortunately, DuckDB’s got our back. Here are two ways to return the month name from a date or timestamp value in DuckDB.

Read more

Generating Date Ranges with DuckDB Queries

Working with date ranges is a common requirement in data analysis, reporting, and time-series operations. DuckDB provides us with several approaches for generating date ranges. This article explores various techniques for creating date ranges in DuckDB.

Read more

6 Functions for Working with the Unix Epoch in DuckDB

DuckDB offers a versatile set of functions to handle timestamps at various levels of precision. This article explores some of DuckDB’s functions that help us to convert between epoch representations and timestamps.

These specialized time conversion functions can be handy tools when working with temporal data, allowing seamless translation between human-readable timestamps and machine-optimized epoch representations at varying levels of precision.

Read more

The Difference Between DATE_DIFF() and DATE_SUB() in DuckDB

In DuckDB, the date_diff() (along with its synonym datediff()) and date_sub() (along with its synonym datesub()) functions allow us to get the difference between two dates. While they might seem similar, they actually calculate date differences in distinct ways that are important to understand for accurate data analysis.

Let’s take a look at the difference between these functions.

Read more

Calculating Time Differences in DuckDB

DuckDB has emerged as a powerful analytical database system designed for fast in-memory data processing. One common analytical task involves calculating time differences between events—whether measuring intervals between transactions, tracking service response times, or analyzing temporal patterns in time series data.

This article provides an exploration of calculating time differences in DuckDB, covering both basic and slightly more advanced techniques.

Read more

Subtract Days from a Date in DuckDB

DuckDB provides us with a couple of easy ways to perform additions and subtractions on dates. In particular, we can use the - operator to do the job, or the date_add() operator combined with the - operator.

Here are two options for subtracting days from a date in DuckDB.

Read more

Detect Infinite Values in DuckDB with the ISINF() Function

In DuckDB, we can use the ISINF() function to check whether a value is finite. DuckDB supports infinite values, and so this function allows us to check for that. This can be useful when working with floating-point data that might contain special values like NaN (Not a Number) or infinity. The function also works on date and timestamp values, as they can be infinite too.

Read more