-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDate.cpp
More file actions
179 lines (129 loc) · 5.29 KB
/
Copy pathDate.cpp
File metadata and controls
179 lines (129 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#include <iostream>
#include "clsDate.h"
using namespace std;
int main() {
clsDate Date1;
Date1.Print();
clsDate Date2("11/4/2022");
Date2.Print();
clsDate Date3(23, 8, 2025);
Date3.Print();
clsDate Date4(250, 2022);
Date4.Print();
Date4.setDay(12);
cout << Date4.getDay() << endl;
Date4.setMonth(2);
cout << Date4.getMonth() << endl;
Date4.setYear(2025);
cout << Date4.getYear() << endl;
cout << Date4.IsLeapYear() << endl;
cout << clsDate::IsLeapYear(2020) << endl;
cout << Date4.NumberOfDaysInMonth() << endl;
cout << clsDate::NumberOfDaysInMonth(2025, 8) << endl;
clsDate Date5;
Date5.setYear(2022);
Date5 = Date5.GetDateFromDayOrderInYear(250);
Date5.Print();
Date5 = clsDate::GetDateFromDayOrderInYear(2022, 250);
Date5.Print();
Date4.Print();
cout << "Date To String:\n" << Date4.DateToString() << endl;
cout << clsDate::DateToString(clsDate(12, 2, 2025)) << endl;
cout << Date4.NumberOfDaysInAYear() << endl;
cout << clsDate::NumberOfDaysInAYear(2025) << endl;
cout << Date4.NumberOfHoursInAYear() << endl;
cout << clsDate::NumberOfHoursInAYear(2020) << endl;
cout << Date4.NumberOfMinutesInAYear() << endl;
cout << clsDate::NumberOfMinutesInAYear(2022) << endl;
cout << Date4.NumberOfSecondsInAYear() << endl;
cout << clsDate::NumberOfSecondsInAYear(2022) << endl;
cout << Date4.CalculateNumberOfDaysFromBeginningOFYear() << endl;
cout << clsDate::CalculateNumberOfDaysFromBeginningOFYear(2025, 8, 23) << endl;
Date4.setDay(28);
Date4.Print();
cout << "Is Last Day In Month: " << Date4.IsLastDayInMonth() << endl;
cout << clsDate::IsLastDayInMonth(clsDate(28, 2, 2025)) << endl;
cout << Date4.IsLastMonthInYear() << endl;
cout << clsDate::IsLastMonthInYear(12) << endl;
Date4.Print();
Date4 = Date4.AddOneDay();
Date4.Print();
Date4 = clsDate::AddOneDay(Date4);
Date4.Print();
cout << Date4.IsDate1EqualToDate2(Date3) << endl;
cout << clsDate::IsDate1EqualToDate2(Date4, Date4) << endl;
cout << Date4.IsDate1LessThanDate2(Date3) << endl;
cout << clsDate::IsDate1LessThanDate2(Date4, Date4) << endl;
cout << Date1.CalculateDifferenceBetweenTwoDatesInDays(Date2, true) << endl;
cout << clsDate::CalculateDifferenceBetweenTwoDatesInDays(Date1, Date2, true) << endl;
clsDate CurrentDate;
CurrentDate = CurrentDate.GetSystemDate();
CurrentDate = clsDate::GetSystemDate();
CurrentDate.Print();
cout << Date1.NumberOfHoursInMonth() << endl;
cout << clsDate::NumberOfHoursInMonth(2025, 8) << endl;
cout << Date1.NumberOfMinutesInMonth() << endl;
cout << clsDate::NumberOfMinutesInMonth(2025, 8) << endl;
cout << Date1.NumberOfSecondsInMonth() << endl;
cout << clsDate::NumberOfSecondsInMonth(2025, 8) << endl;
Date1.Print();
cout << Date1.DefineDayOrder() << endl;
cout << clsDate::DefineDayOrder(2025, 8, 23) << endl;
short DayOrder = Date1.DefineDayOrder();
cout << Date1.DefineDayName(DayOrder) << endl;
cout << clsDate::DefineDayName(DayOrder) << endl;
cout << Date1.MonthName() << endl;
cout << clsDate::MonthName(8) << endl;
Date1.PrintMonthCalendar();
clsDate::PrintMonthCalendar(2025, 8);
Date1.PrintYearCalendar();
clsDate::PrintYearCalendar(2025);
Date1.Print();
Date1 = Date1.AddDaysToDate(3);
Date1.Print();
Date1 = clsDate::AddDaysToDate(3, clsDate(23, 8, 2025));
Date1.Print();
cout << Date4.IsEndOfWeek(2) << endl;
cout << clsDate::IsEndOfWeek(6) << endl;
Date4.Print();
cout << Date4.DaysUntilTheEndOfMonth() << endl;
cout << clsDate::DaysUntilTheEndOfMonth(clsDate(23, 8, 2025))<< endl;
Date4.setDay(2);
Date4.setMonth(1);
Date4.setYear(2025);
cout << Date4.DaysUntilTheEndOfYear(clsDate(31,12,2025)) << endl;
cout << clsDate::DaysUntilTheEndOfYear(clsDate(31, 12, 2025), Date4) << endl;
cout << clsDate::DayOfWeekOrder(clsDate(23, 8, 2025)) << endl;
cout << clsDate::DayOfWeekOrder(2025, 8, 23) << endl;
clsDate Date8(24, 8, 2025);
cout << Date8.CompareTwoDates(clsDate(23, 8, 2025)) << endl;
cout << clsDate::CompareTwoDates(clsDate(22, 8, 2025), clsDate(22, 8, 2025)) << endl;
cout << Date8.IsValidDate() << endl;
cout << clsDate::IsValidDate(clsDate(31, 2, 2025)) << endl;
clsDate Date11(250, 2022);
Date11.Print();
Date1.Print();
Date2.Print();
clsDate::SwapDates(Date1, Date2);
Date1.Print();
Date2.Print();
clsDate BirthDate(28, 8, 2005);
cout << clsDate::CalculateAgeInDays(BirthDate) << endl;
clsDate DateIncreased(1, 1, 2025);
DateIncreased.IncreaseDateByXDays(10);
DateIncreased.Print();
DateIncreased = clsDate::IncreaseDateByXDays(DateIncreased, 10);
DateIncreased.Print();
clsDate DateDecresed(1, 1, 2025);
DateDecresed.DecreaseDateByXDays(10);
DateDecresed.Print();
DateDecresed = clsDate::DecreaseDateByXDays(DateDecresed, 10);
DateDecresed.Print();
clsDate DateVacationStarting(23, 8, 2025);
clsDate DateVacationEnding(29, 8, 2025);
cout << DateVacationStarting.CalculateVacationDays(DateVacationStarting, DateVacationEnding) << endl;
cout << clsDate::CalculateVacationDays(DateVacationStarting, DateVacationEnding) << endl;
cout << DateVacationStarting.CalculateBusinessDays(DateVacationStarting, DateVacationEnding) << endl;
cout << clsDate::CalculateBusinessDays(DateVacationStarting, DateVacationEnding) << endl;
return 0;
}