xtd 0.2.0
Loading...
Searching...
No Matches

◆ day_of_week

enum class xtd::day_of_week
strong

Specifies the day of the week.

Namespace
xtd
Header
#include <xtd/day_of_week>
Library
xtd.core
Examples
The following example demonstrates the xtd::date_time::day_of_week property and the xtd::day_of_week enumeration.
#include <xtd/console>
#include <xtd/date_time>
#include <xtd/startup>
using namespace xtd;
class program {
public:
static auto main() {
// Create a DateTime for the first of May, 2003.
auto dt = date_time {2003, 5, 1};
console::write_line("Is Thursday the day of the week for {0:d}?: {1}", dt, dt.day_of_week() == day_of_week::thursday);
console::write_line("The day of the week for {0:d} is {1}.", dt, dt.day_of_week());
}
};
startup_(program::main);
// This code produces the following output :
//
// Is Thursday the day of the week for 05/01/2003?: true
// The day of the week for 05/01/2003 is thursday.
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.h:85
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.h:175
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Remarks
The xtd::day_of_week enumeration represents the day of the week in calendars that have seven days per week. The value of the constants in this enumeration ranges from xtd::day_of_week::sunday to xtd::day_of_week::saturday. If cast to an integer, its value ranges from zero (which indicates xtd::day_of_week::sunday) to six (which indicates xtd::day_of_week::saturday).
This enumeration is useful when it is desirable to have a strongly typed specification of the day of the week. For example, this enumeration is the type of the property value for the xtd::date_time::day_of_week and xtd::date_time_offset::day_of_week properties.
The members of the xtd::day_of_week enumeration are not localized. To return the localized name of the day of the week, call the xtd::date_time::to_string(string) method with either the "h" or "H" format strings. The former format string produces the abbreviated weekday name; the latter produces the full weekday name.
Enumerator
sunday 

Indicates sunday.

monday 

Indicates monday.

tuesday 

Indicates tuesday.

wednesday 

Indicates wednesday.

thursday 

Indicates thursday.

friday 

Indicates friday.

saturday 

Indicates saturday.