Pandas → T-SQL › dt.to_period

Pandas to_period to CONVERT / DATEPART

A period is a grain. Write the grain as an expression and GROUP BY it.

CONVERT(char(7), order_date, 120) AS ym
-- quarter
CONCAT(DATEPART(year, order_date), '-Q', DATEPART(quarter, order_date))

Fiscal quarters: /tools/fiscal-year.

Canonical translation

CONVERT(char(7), order_date, 120) AS ym
-- quarter
CONCAT(DATEPART(year, order_date), '-Q', DATEPART(quarter, order_date))

Then write it on a ticket

Monday is free. A colleague asks, you type, we mark it.

Clock in free