C Program to Display the current Date and Time

bookmark

#include<stdio.h>
#include<time.h>

int main()
{
    printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");

    time_t t;   // not a primitive datatype
    time(&t);

    printf("\nThis program has been writeen at (date and time): %s", ctime(&t));

    printf("\n\n\t\t\tCoding is Fun !\n\n\n");
    return 0;
}

 

Output

Studytonight - Best place to learn


This program has been writeen at (date and time): Mon Jul  3 10:40:37 2023


            Coding is Fun !