Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / Date / Date.cpp
diff options
context:
space:
mode:
Commite9284e319a1b73ba9afe49f5c5b8cae9605d674c (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 09:33:17 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 09:33:17 +0300
Filesa4e72e86c534912b7e3398f1d9ed90c82e9502dc /src/Generic/Date/Date.cpp
FMI-OOP-P1_TicketSystem-e9284e319a1b73ba9afe49f5c5b8cae9605d674c.tar
FMI-OOP-P1_TicketSystem-e9284e319a1b73ba9afe49f5c5b8cae9605d674c.tar.gz
FMI-OOP-P1_TicketSystem-e9284e319a1b73ba9afe49f5c5b8cae9605d674c.zip
Parent73bec1424d7412cbdbacbe5ebe467c1047dc1001 (diff)
Autocommit at 08.05.2022 @ 09:33
1 files changed, 11 insertions, 0 deletions
-rw-r--r--src/Generic/Date/Date.cpp11
diff --git a/src/Generic/Date/Date.cpp b/src/Generic/Date/Date.cpp
index b9f24d3..4961698 100644
--- a/src/Generic/Date/Date.cpp
+++ b/src/Generic/Date/Date.cpp
@@ -19,6 +19,17 @@ unsigned short Date::daysInMonth() {
Date::Date() : Date(01, 05, 2022) {}
+Date::Date(const char* str) : Date(0, 0, 0) {
+ for (unsigned i = 0; i < MAX_LINE_WIDTH && y == 0; i++) {
+ if (dateStr[i] != ' ') {
+ if (d == 0) d = atoi(dateStr + i);
+ else if (m == 0) m = atoi(dateStr + i);
+ else y = atoi(dateStr + i);
+ i++;
+ }
+ }
+}
+
Date::Date(unsigned short day, unsigned short month, unsigned short year) {
this->day = day;
this->month = month;