GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::chrono::weekday_last::weekday_last(3) C++ Standard Libary std::chrono::weekday_last::weekday_last(3)

std::chrono::weekday_last::weekday_last - std::chrono::weekday_last::weekday_last


explicit constexpr weekday_last( const std::chrono::weekday& wd ) (since C++20)
noexcept;


Constructs a weekday_last object storing the weekday wd.


A more convenient way to construct a weekday_last is with weekday's operator[],
i.e., wd[std::chrono::last].

// Run this code


#include <chrono>
#include <iostream>
using namespace std::chrono;


int main() {
const year_month_day ymd { floor<days>(system_clock::now()) };
const weekday_last wdl { Sunday[last] }; // A last Sunday of a month
const year_month_day last_sun { ymd.year() / ymd.month() / wdl };


std::cout << "The last Sunday of current month falls on "
<< (int)last_sun.year() << '/'
<< (unsigned)last_sun.month() << '/'
<< (unsigned)last_sun.day() << '\n';
}


The last Sunday of current month falls on 2021/9/26

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.