std::chrono...ay_last::ok(3)
okay so this page is from the C++ Standard Libary manual, and the title up top is std::chrono...ay_last::ok(3) β yes, that exact lil truncation, iykyk π
. We're talking about a chrono function and it's honestly not that deep, bestie. Let's go. β¨
π NAME π
std::chrono::year_month_day_last::ok β literally std::chrono::year_month_day_last::ok π
β¨ Synopsis β¨
constexpr bool ok() const noexcept; (since C++20)
Checks if *this represents a valid date. Because a year_month_day_last represents the last day of a particular month, it represents a valid date as long as the year and month are valid. That's it, that's the whole check, and it ate. π«Ά
π Return value π
year().ok() && month().ok()
πΈ Example πΈ
The manual gives you a // Run this code moment, and here's the code exactly:
#include <cassert>
#include <chrono>
int main()
{
auto ymdl{std::chrono::last/11/2020};
assert(ymdl.ok());
ymdl =
std::chrono::year(2020)/std::chrono::month(13)/std::chrono::last;
assert(not ymdl.ok());
}
sending you a big kiss π«Ά β this page is from http://cppreference.com and it's dated 2024.06.10. byeeee ππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms