C program to print the current date and timeToday we will see that how to print the today date and time using c programming language.
in which we use the 'time.h' libarary.
ALGORITHM:-
Step 1: import the respect directory
Step 2: import the time.h directory
Step 3: define a time type variable
Step 4: print the time type variable with ctime(&t)
Step 5: terminate
PROGRAM CODE:-
#include<stdio.h>
#include<conio.h>
#include<time.h>
void main()
{
time_t t; //there we declared the time type variable which is t
time(&t); //
clrscr();
printf("Today date and time is: %s",ctime(&t));
getch();
}
OUTPUT:-
Today date and time is: 19 july 12:24:01
C program to display the current date and time using c How to print the date and time in c How to display system date time in c
ConversionConversion EmoticonEmoticon