forked from KarthikeyanKS00747/Conference_Management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDateTime.cpp
26 lines (21 loc) · 1.47 KB
/
DateTime.cpp
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
#include <string>
#include <sstream>
#include <chrono>
#include <format>
class DateTime {
private:
std::string date_; // The date in MM-DD-YYYY format
std::string time_; // The time in HH:MM:SS format
std::string day_; // The day of the week
public:
DateTime(); // Default constructor: Initializes date_ and time_ to default values
DateTime(const DateTime& other); // Copy constructor: Initializes a new DateTime object with the same date, time, and day
// as another DateTime object
DateTime(std::string date, std::string time); // Constructor: Initializes date_ and time_ with the given arguments
std::string getDay() const; // Member function: Returns the day of the week for the date_
std::string displayDate(std::string format); // Member function: Returns the date_ in the specified format
std::string displayTime(); // Member function: Returns the time_
static bool checkDateTime(std::string& date_, std::string& timeSlot_); // Static member function: Checks if the given date and time are valid
bool operator==(const DateTime& other) const; // Operator overload: Compares this DateTime object with
// another based on date_ and time_
};