# std::chrono::month_day_last::ok

From cppreference.com
< cpp‎ | chrono‎ | month day last

constexpr bool ok() const noexcept; |  | (since C++20)

Checks if the `month` object stored in `*this` is valid.

### Return value

month().ok()

### Example

Run this code

    #include <iostream>
    #include <chrono>

    int main()
    {
        std::cout << std::boolalpha;

        auto mdl {std::chrono::February/std::chrono::last};
        std::cout << (mdl.ok()) << ' ';
        mdl = {std::chrono::month(42)/std::chrono::last};
        std::cout << (mdl.ok()) << '\n';
    }

Output:

    true false

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/chrono/month_day_last/ok&oldid=146054"