Does Anybody Know How I Could Get Current Date (Short Date) In C Programming Language [Archive] - SpeedGuide.net Broadband Community

View Full Version : Does Anybody Know How I Could Get Current Date (Short Date) In C Programming Language


Vishy8015
06-07-05, 04:56 AM
Does Anybody Know How I Could Get Current Date (Short Date) In C Programming Language

TonyT
06-07-05, 07:14 AM
13.12: How can I get the current date or time of day in a C program?

A: Just use the time(), ctime(), localtime() and/or strftime()
functions. Here is a simple example:

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

int main()
{
time_t now;
time(&now);
printf("It's %.24s.\n", ctime(&now));
return 0;
}