Display Date and Time in C++

0 votes
26 views
asked Dec 19, 2013 in C++ by raghav

1 Answer

0 votes
answered Dec 19, 2013 by Govind

Here is some sample code that shows how to get the date and time on a DOS system. 
 

#include
#include
#include

void main()
{
  struct dosdate_t govind;
  _dos_getdate(&govind);
  clrscr();
  printf("The current year is: %d\n", govind.year);
  printf("The current day is: %d\n", govind.day);
  printf("The current month is: %d\n", govind.month);
}
...