Im trying to get the up to date dates and times but this isnt working. #include
ID: 664778 • Letter: I
Question
Im trying to get the up to date dates and times but this isnt working.
#include "TimeClass.h"
#include <stdio.h>
///////////////////////////////////////////////////////////////////////////////
// Class to help with the usage of time.
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;
///////////////////////////////////////////////////////////////////////////////
CTimeClass::CTimeClass()
{
SYSTEMTIME st;
// Notice that the time is stored whenever (and only) when
// this time object is created. Use this to your advantage below in main.
}
///////////////////////////////////////////////////////////////////////////////
CTimeClass::~CTimeClass()
{
// Empty - Nothing to destroy here.
}
short CTimeClass::GetYear()
{
int year;
year = st.wYear;
return year;
}
///////////////////////////////////////////////////////////////////////////////
string CTimeClass::GetMonth()
{
int getMonth;
string month;
getMonth = st.wMonth;
if (getMonth == 1)
month = "January";
else if (getMonth == 2)
month = "February";
else if (getMonth == 3)
month = "March";
else if (getMonth == 4)
month = "April";
else if (getMonth == 5)
month = "May";
else if (getMonth == 6)
month = "June";
else if (getMonth == 7)
month = "July";
else if (getMonth == 8)
month = "August";
else if (getMonth == 9)
month = "September";
else if (getMonth == 10)
month = "October";
else if (getMonth == 11)
month = "November";
else if (getMonth == 12)
month = "December";
return month;
}
///////////////////////////////////////////////////////////////////////////////
short CTimeClass::GetDay()
{
int day;
day = st.wDay;
return day;
}
///////////////////////////////////////////////////////////////////////////////
string CTimeClass::GetDayOfWeek()
{
int dayOfWeek;
string dayWeek;
if (dayOfWeek == 0)
dayWeek = "Sunday";
else if (dayOfWeek == 1)
dayWeek = "Monday";
else if (dayOfWeek == 2)
dayWeek = "Tuesday";
else if (dayOfWeek == 3)
dayWeek = "Wednesday";
else if (dayOfWeek == 4)
dayWeek = "Thursday";
else if (dayOfWeek == 5)
dayWeek = "Friday";
else if (dayOfWeek == 6)
dayWeek = "Saturday";
return dayWeek;
}
///////////////////////////////////////////////////////////////////////////////
short CTimeClass::GetHour()
{
int hour;
hour = st.wHour;
return hour;
}
///////////////////////////////////////////////////////////////////////////////
short CTimeClass::GetMinute()
{
int minute;
minute = st.wMinute;
return minute;
}
///////////////////////////////////////////////////////////////////////////////
short CTimeClass::GetSecond()
{
int second;
second = st.wSecond;
return second;
}