35 pts.
 Abstract system date in C++
hi, iam rakesh a MCA student .iwant to abstract system date and time in my c++ project,what should be method for this .please give specific code.
ASKED: Mar 13, 2009  11:29 AM GMT
UPDATED: March 13, 2009  2:51:32 PM GMT
60,255 pts.

Answer Wiki:
If you want to retrieve the current system date and time (and you are on a windows system), you could use the GetLocalTime function.

Here is an example:

SYSTEMTIME time;

GetLocalTime (&time);


The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.

typedef struct _SYSTEMTIME {  // st 
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;


Other option, that will work on non-windows systems is to use the functions from time.h

Example:

#include <time.h>

void main( int argc, char *argv[] )
{
time_t t;
time(&t);
...
...
}
Last Wiki Answer Submitted:  Mar 13, 2009  2:51 PM (GMT)  by  Carlosdl   60,255 pts.
To see other answers submitted to the Answer Wiki View Answer History.
Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _