Write a program in C++ to print system Date and Time using Time functions. - WAY2IT

Latest Post :

Write a program in C++ to print system Date and Time using Time functions.



Code :-

#include <dos.h>
#include <stdio.h>
#include<conio.h>
#include<iostream.h>
int main(void)
{
struct date d;
clrscr();
getdate(&d);
cout<<"The current year is:\t"<<(int)d.da_year;
cout<<"\nThe current day is:\t"<<(int)d.da_day;
cout<<"\nThe current month is:\t"<<(int)d.da_mon;
getch();
return 0;
}



Output :-