|
From: Ricardo R. <ri...@po...> - 2003-03-20 09:49:45
|
You can have different solutions as indicated in Schildt's book.
For instance, one of them is:
*********************
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
struct tm *punt;
time_t lt;
lt=time(NULL);
punt=localtime(<);
printf(asctime(punt));
system("PAUSE");
return 0;
}
**********************
(1) time( ) gives the actual date and hour in a struct of type time_t;
(2) localtime( ) separates the local time of the struct "lt" in a
struct of type tm.
(3) asctime( ) converts this information in a char array with the format:
day month date hour: minutes:seconds year \n\0
I hope this can help you.
Ricardo.
|