- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
class Date
{
private DateTime date;
public Date(int day,int month,int year)
{
if(month > 0 && month < 13 && day > 0 && day <= DateTime.DaysInMonth(year,month)) // Это не надо, моё введение.
date = new DateTime(year,month,day);
else Console.WriteLine("Неверная дата.");//
}
public Date()
{
date= new DateTime(2009,01,01);
}
public DateTime Yesterday()
{
return date.AddDays(-1);
}
public DateTime NextDay()
{
return date.AddDays(1);
}
public int Days()
{
return DateTime.DaysInMonth(date.Year,date.Month)-date.Day;
}
public DateTime GetDate
{
get
{
return date;
}
set
{
date = value;
}
}
public bool IsLeapYear
{
get
{
return DateTime.IsLeapYear(date.Year);
}
}
}