quarterOfYear property

int get quarterOfYear

Returns the quarter of the year (1–4).

DateTime(2024, 5, 1).quarterOfYear // 2

Implementation

int get quarterOfYear => ((month - 1) ~/ 3) + 1;