Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Data + Time

Status
Not open for further replies.

Skute

Programmer
Joined
Jul 21, 2003
Messages
272
Location
GB
[Non MFC]

Hi,

how can i get the current system date and time and format it nicely?

Ive seen some function in the CRT but i dont really want to use them as yet. Is there a windows API call i can make?

Thanks
 
GetSystemTime()
Code:
typedef struct _SYSTEMTIME {  
WORD wYear;  
WORD wMonth;  
WORD wDayOfWeek;  
WORD wDay;  
WORD wHour;  
WORD wMinute;  
WORD wSecond;  
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;

>> and format it nicely?

Sorry but that is not a valid requirement since it is completely ambiguous.

-pete
 
Thanks alot,

for the formatting i just meant, format as a long date type and convert it to a character string or something, but that shouldnt be too difficult.

thanks for quick reply
 
To use dates and to format them as strings in standard date representations like ISO date string use the BOOST gregorian::date class.

For custom formating the C++ runtime library provides the ASNI fucntion strftime.

-pete
 
>> ASNI fucntion
[lol] darn fingers... ANSI function

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top