OpenSiv3D  v0.6.5
C++20 framework for creative coding
s3d::Date Struct Reference

日付 | Date More...

#include <Date.hpp>

Inherited by s3d::DateTime.

Public Member Functions

SIV3D_NODISCARD_CXX20 Date () noexcept=default
 デフォルトコンストラクタ More...
 
constexpr SIV3D_NODISCARD_CXX20 Date (int32 _year, int32 _month=1, int32 _day=1) noexcept
 日付を作成します。 More...
 
constexpr DayOfWeek dayOfWeek () const noexcept
 曜日を返します。 More...
 
bool isToday () const noexcept
 現在のローカルの年月日と一致するかを返します。 More...
 
constexpr bool isLeapYear () const noexcept
 うるう年であるかを返します。 More...
 
constexpr int32 daysInYear () const noexcept
 1 年の日数を返します。 More...
 
constexpr int32 daysInMonth () const noexcept
 月の日数を返します。 More...
 
constexpr bool isValid () const noexcept
 日付の妥当性を返します。 More...
 
String format (StringView format=U"yyyy-MM-dd"_sv) const
 日付を指定したフォーマットの文字列で返します。 yyyy 4 桁の年 (0001-) yy 2 桁の年 (00-99) y 年 (1-) MMMM 英語の月 (January-December) MMM 英語の月の略称 (Jan-Dec) MM 2 桁の月 (01-12) M 1-2 桁の月 (1-12) dd 2 桁の日 (01-31) d 1-2 桁の日 (1-31) EEEE 英語の曜日 (Sunday-Saturday) EEE 英語の曜日の略称 (Sun-Sat) E 日本語の曜日 (日-土) More...
 
Date operator+ (const Days &days) const noexcept
 指定した日数だけ進めた日付を返します。 More...
 
Date operator- (const Days &days) const noexcept
 指定した日数だけ戻した日付を返します。 More...
 
Dateoperator+= (const Days &days) noexcept
 日付を進めます More...
 
Dateoperator-= (const Days &days) noexcept
 日付を戻します More...
 
size_t hash () const noexcept
 日付のハッシュ値を返します More...
 

Static Public Member Functions

static Date Yesterday () noexcept
 昨日の日付(ローカルタイム)を返します。 More...
 
static Date Today () noexcept
 現在の日付(ローカルタイム)を返します。 More...
 
static Date Tomorrow () noexcept
 明日の日付(ローカルタイム)を返します。 More...
 
static constexpr bool IsLeapYear (int32 year) noexcept
 
static constexpr int32 DaysInYear (int32 year) noexcept
 
static constexpr int32 DaysInMonth (int32 year, int32 month) noexcept
 
static constexpr Days Subtract (const Date &a, const Date &b) noexcept
 

Public Attributes

int32 year
 西暦 More...
 
int32 month
 月 [1-12] More...
 
int32 day
 日 [1-31] More...
 

Friends

constexpr friend Days operator- (const Date &to, const Date &from) noexcept
 日付の差を計算します。 More...
 
bool operator== (const Date &lhs, const Date &rhs) noexcept
 日付が等しいかを返します。 More...
 
bool operator!= (const Date &lhs, const Date &rhs) noexcept
 日付が異なるかを返します。 More...
 
bool operator< (const Date &lhs, const Date &rhs) noexcept
 日付の < 比較を行います。 More...
 
bool operator> (const Date &lhs, const Date &rhs) noexcept
 日付の > 比較を行います。 More...
 
bool operator<= (const Date &lhs, const Date &rhs) noexcept
 日付の <= 比較を行います。 More...
 
bool operator>= (const Date &lhs, const Date &rhs) noexcept
 日付の >= 比較を行います。 More...
 
template<class CharType >
std::basic_ostream< CharType > & operator<< (std::basic_ostream< CharType > &output, const Date &value)
 
void Formatter (FormatData &formatData, const Date &value)
 

Detailed Description

日付 | Date

Constructor & Destructor Documentation

◆ Date() [1/2]

SIV3D_NODISCARD_CXX20 s3d::Date::Date ( )
defaultnoexcept

デフォルトコンストラクタ

◆ Date() [2/2]

constexpr SIV3D_NODISCARD_CXX20 s3d::Date::Date ( int32  _year,
int32  _month = 1,
int32  _day = 1 
)
explicitconstexprnoexcept

日付を作成します。

Parameters
_year西暦
_month
_day
Remarks
指定された日付が存在するかはチェックされません。

Member Function Documentation

◆ dayOfWeek()

constexpr DayOfWeek s3d::Date::dayOfWeek ( ) const
constexprnoexcept

曜日を返します。

Returns
曜日

◆ daysInMonth()

constexpr int32 s3d::Date::daysInMonth ( ) const
constexprnoexcept

月の日数を返します。

Returns
月の日数

◆ DaysInMonth()

static constexpr int32 s3d::Date::DaysInMonth ( int32  year,
int32  month 
)
staticconstexprnoexcept
Parameters
year
month
Returns

◆ daysInYear()

constexpr int32 s3d::Date::daysInYear ( ) const
constexprnoexcept

1 年の日数を返します。

Returns
1 年の日数

◆ DaysInYear()

static constexpr int32 s3d::Date::DaysInYear ( int32  year)
staticconstexprnoexcept
Parameters
year
Returns

◆ format()

String s3d::Date::format ( StringView  format = U"yyyy-MM-dd"_sv) const

日付を指定したフォーマットの文字列で返します。 yyyy 4 桁の年 (0001-) yy 2 桁の年 (00-99) y 年 (1-) MMMM 英語の月 (January-December) MMM 英語の月の略称 (Jan-Dec) MM 2 桁の月 (01-12) M 1-2 桁の月 (1-12) dd 2 桁の日 (01-31) d 1-2 桁の日 (1-31) EEEE 英語の曜日 (Sunday-Saturday) EEE 英語の曜日の略称 (Sun-Sat) E 日本語の曜日 (日-土)

Parameters
formatフォーマット指定
Returns
フォーマットされた日付

◆ hash()

size_t s3d::Date::hash ( ) const
noexcept

日付のハッシュ値を返します

Returns
日付のハッシュ値

◆ isLeapYear()

constexpr bool s3d::Date::isLeapYear ( ) const
constexprnoexcept

うるう年であるかを返します。

Returns
うるう年である場合 true, それ以外の場合は false

◆ IsLeapYear()

static constexpr bool s3d::Date::IsLeapYear ( int32  year)
staticconstexprnoexcept
Parameters
year
Returns

◆ isToday()

bool s3d::Date::isToday ( ) const
noexcept

現在のローカルの年月日と一致するかを返します。

Returns
現在のローカルの年月日と一致する場合 true, それ以外の場合は false

◆ isValid()

constexpr bool s3d::Date::isValid ( ) const
constexprnoexcept

日付の妥当性を返します。

Returns
日付が正しい範囲の値であれば true, それ以外の場合は false

◆ operator+()

Date s3d::Date::operator+ ( const Days days) const
noexcept

指定した日数だけ進めた日付を返します。

Parameters
days日数
Returns
指定した日数だけ進めた日付

◆ operator+=()

Date& s3d::Date::operator+= ( const Days days)
noexcept

日付を進めます

Parameters
days進める日数
Returns
*this

◆ operator-()

Date s3d::Date::operator- ( const Days days) const
noexcept

指定した日数だけ戻した日付を返します。

Parameters
days日数
Returns
指定した日数だけ戻した日付

◆ operator-=()

Date& s3d::Date::operator-= ( const Days days)
noexcept

日付を戻します

Parameters
days戻す日数
Returns
*this

◆ Subtract()

static constexpr Days s3d::Date::Subtract ( const Date a,
const Date b 
)
staticconstexprnoexcept
Parameters
a
b
Returns

◆ Today()

static Date s3d::Date::Today ( )
staticnoexcept

現在の日付(ローカルタイム)を返します。

Returns
現在の日付(ローカルタイム)

◆ Tomorrow()

static Date s3d::Date::Tomorrow ( )
staticnoexcept

明日の日付(ローカルタイム)を返します。

Returns
明日の日付(ローカルタイム)

◆ Yesterday()

static Date s3d::Date::Yesterday ( )
staticnoexcept

昨日の日付(ローカルタイム)を返します。

Returns
昨日の日付(ローカルタイム)

Friends And Related Function Documentation

◆ Formatter

void Formatter ( FormatData formatData,
const Date value 
)
friend
Parameters
formatData
value

◆ operator!=

bool operator!= ( const Date lhs,
const Date rhs 
)
friend

日付が異なるかを返します。

Parameters
lhs比較する日付
rhs比較する日付
Returns
2 つの日付が異なる場合 true, それ以外の場合は false

◆ operator-

constexpr friend Days operator- ( const Date to,
const Date from 
)
friend

日付の差を計算します。

Parameters
to日付
from日付
Returns
from から to までの日数

◆ operator<

bool operator< ( const Date lhs,
const Date rhs 
)
friend

日付の < 比較を行います。

Parameters
lhs比較する日付
rhs比較する日付
Returns
比較結果

◆ operator<<

template<class CharType >
std::basic_ostream<CharType>& operator<< ( std::basic_ostream< CharType > &  output,
const Date value 
)
friend
Template Parameters
CharType
Parameters
output
value
Returns

◆ operator<=

bool operator<= ( const Date lhs,
const Date rhs 
)
friend

日付の <= 比較を行います。

Parameters
lhs比較する日付
rhs比較する日付
Returns
比較結果

◆ operator==

bool operator== ( const Date lhs,
const Date rhs 
)
friend

日付が等しいかを返します。

Parameters
lhs比較する日付
rhs比較する日付
Returns
2 つの日付が等しい場合 true, それ以外の場合は false

◆ operator>

bool operator> ( const Date lhs,
const Date rhs 
)
friend

日付の > 比較を行います。

Parameters
lhs比較する日付
rhs比較する日付
Returns
比較結果

◆ operator>=

bool operator>= ( const Date lhs,
const Date rhs 
)
friend

日付の >= 比較を行います。

Parameters
lhs比較する日付
rhs比較する日付
Returns
比較結果

Member Data Documentation

◆ day

int32 s3d::Date::day

日 [1-31]

◆ month

int32 s3d::Date::month

月 [1-12]

◆ year

int32 s3d::Date::year

西暦


The documentation for this struct was generated from the following file: