The ctime() function is define in the time.h header file. The ctime() function returns the string representing the localtime based on the argument timer.
char *ctime(const time_t *timer)
Parameters: This function accepts single parameter time_ptr. It is used to set time_t object that contains a time value.
Return Value: This function returns a string that contains the date and time which is in human readable form.
Www Mmm dd hh:mm:ss yyyy
Note: The description of results are given below:
- Www: Day of week.
- Mmm: Month name.
- dd : Day of month.
- hh : Hour digit.
- mm : Minute digit.
- ss : Second digit.
- yyyy : Year digit.
Current time = Fri Sep 28 08:13:09 2018
- gmtime() Function in C/C++
- getopt() function in C to parse command line arguments
- How to return multiple values from a function in C or C++?
- time() function in C
- Lex program to find the length of the longest word
- Lex Program to accept string starting with vowel
- Lex Program to check valid email
- How to get the current position of cursor from output screen in C?
- Draw a moving car using computer graphics programming in C
- Lex Program to accept a valid integer and float value
- Check whether the number can be made perfect square after adding 1
- Program for conversion of 32 Bits Single Precision IEEE 754 Floating Point Representation
- C program to store Student records as Structures and Sort them by Name
- Check whether the given character is in upper case, lower case or non alphabetic character
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.