by Dinesh Thakur Category: Function and Pointer

The function prototype of ctime () is written in the following manner:

char *ctime( const time_t *Timeptr);

The function ctime ()converts-the calendar time pointed to by Timeptr into local time and puts it in the form of a string which expresses time in terms of day, month, date, hour, minutes, seconds, and year as illustrated in the output of Program.

#include <stdio.h>

#include <time.h>
void main()
  time_t Date_Time ;
  time(& Date_Time);
  printf("%s", ctime(& Date_Time));

Function ctime () in C

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles