Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Create a console application that prints the current date and time.
- * (15 September 2015 16:25:17)
- */
- #include <stdio.h>
- #include <time.h>
- int main()
- {
- time_t t = time(NULL);
- struct tm tm = *localtime(&t);
- char* arrMonthNames[12] = {"January", "February", "March", "April", "May", "June", "July",
- "August", "September", "October", "November", "December"};
- printf("Current Date and Time is: %02d %s %d %02d:%02d:%02d\n",
- tm.tm_mday, arrMonthNames[tm.tm_mon], tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec);
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement