/// <Summary>
/// Whether the primary certificate has five Friday, five Saturday, and five Sundays
/// The year of the next occurrence
/// </Summary>
/// <Param name = "ARGs"> </param>
Static void main (string [] ARGs)
{
// Current time
Datetime dtnow = datetime. now;
// The current time is smaller than the maximum value
While (dtnow <datetime. maxvalue)
{
// The month must be 31 days before the month to add one
Datetime nextmonth = dtnow. addmonths (1 );
// The first day of the month in the next month is a week.
Datetime firstdayofnextmonth = new datetime (nextmonth. Year, nextmonth. month, 1 );
// Determine whether the first day of the month is 31 days and the first day of the month must be Friday.
If (datetime. daysinmonth (nextmonth. Year, nextmonth. month) = 31 & firstdayofnextmonth. dayofweek = dayofweek. Friday)
{
Console. writeline ("the next generation is at: {0}", firstdayofnextmonth );
Break;
}
Dtnow = nextmonth;
}
Console. Readline ();
}
/// <Summary>
/// Last year of occurrence
/// </Summary>
/// <Param name = "ARGs"> </param>
// Static void main (string [] ARGs)
//{
/// // Current time
/// Datetime dtnow = datetime. now;
/// // The current time is smaller than the maximum value
//// While (datetime. minvalue <= dtnow)
////{
//// The month must be 31 days before the first day of the month
/// Datetime nextmonth = dtnow. addmonths (-1 );
///// The first day of the month of the next year is a shard.
/// Datetime firstdayofnextmonth = new datetime (nextmonth. Year, nextmonth. month, 1 );
///// Determine whether the first day of the month is 31 days and the first day of the month must be Friday.
/// If (datetime. daysinmonth (nextmonth. Year, nextmonth. month) = 31 & firstdayofnextmonth. dayofweek = dayofweek. Friday)
////{
/// Console. writeline ("Last generated at: {0}", firstdayofnextmonth );
//// Break;
////}
/// Dtnow = nextmonth;
////}
//// Console. Readline ();
//}