#include <stdio.h> #include <time.h> void main( ) { char dateStr [9]; char timeStr [9]; _strdate( dateStr); printf( "The current date is %s \n", dateStr); _strtime( timeStr ); printf( "The current time is %s \n", timeStr); } or using SYSTEMTIME #include <Windows.h> #include <stdio.h> void main() { SYSTEMTIME st; GetSystemTime(&st); printf("Year:%d\nMonth:%d\nDate:%d\nHour... d\n" ,st.wYear,st.wMonth,st.wDay,st.wHour,st.... } SYSTEMTIME looks like this: typedef struct _SYSTEMTIME { WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds; } SYSTEMTIME;