absl::NextWeekday

Returns the absl::CivilDay that strictly follows a given absl::CivilDay, and that falls on the given absl::Weekday.

Synopsis

Declared in <absl/time/civil_time.h>

CivilDay
NextWeekday(
    CivilDay cd,
    Weekday wd);

Description

Example, given the following month:

August 2015 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

absl::CivilDay a(2015, 8, 13); // absl::GetWeekday(a) == absl::Weekday::thursday absl::CivilDay b = absl::NextWeekday(a, absl::Weekday::thursday); // b = 2015-08-20 absl::CivilDay c = absl::PrevWeekday(a, absl::Weekday::thursday); // c = 2015-08-06

absl::CivilDay d = ... // Gets the following Thursday if d is not already Thursday absl::CivilDay thurs1 = absl::NextWeekday(d - 1, absl::Weekday::thursday); // Gets the previous Thursday if d is not already Thursday absl::CivilDay thurs2 = absl::PrevWeekday(d + 1, absl::Weekday::thursday);

Return Value

The first civil day strictly after cd that falls on wd.

Parameters

NameDescription
cdThe civil day to start from.
wdThe weekday to look for.