C program to get date.

Posted by Mangesh on May 02, 2018

/* program to get today date in c */

Description :

To get date from system in C, we have a function call "getdate()" in "dos.h" header file.

Program :

#include<stdio.h>
#include<conio.h>
#include<dos.h> 
int main()
{
   struct date today;
   clrscr();
   getdate(&today);
   printf("Current system date: %d/%d/%d", today.da_day, today.da_mon, today.da_year);
   getch();
   return 0;
}

Output :

program to get date Executed and tested in Turbo C 3.2

Written with from Mangesh.

Related Post
1 C program to get date.
2 C program for Hello World.
3 C program to swap two number without third extra variable.
4 C program to find square root of a number.
5 C program for printing random number.
Latest Post
1 C program to implement Queue using linked list.
2 C program for binary search tree (BST).
3 C program to search an element in linked list.
4 C program for postorder traversal in binary tree.
5 C program for preorder traversal in binary tree.