You are here

C program to print date

C program to print current system date. To print date, we will use getdate function.

C programming code (Works in Turbo C only)

  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <dos.h>
  4.  
  5. int main()
  6. {
  7.    struct date d;
  8.  
  9.    getdate(&d);
  10.  
  11.    printf("Current system date: %d/%d/%d", d.da_day, d.da_mon, d.da_year);
  12.    getch();
  13.    return 0;
  14. }

This code works in Turbo C only because it supports dos.h header file.