Click to See Complete Forum and Search --> : How to get PC Cuurent Time by using C


yang
July 22nd, 1999, 04:54 PM
I understand that I can use the GetCurrentTime class for getting Current time from PC in C++. I just wonder how to write code for getting current time from PC by using C.

Thank you for any help.

July 22nd, 1999, 07:29 PM
localtime()

Paul Belikian
July 22nd, 1999, 11:00 PM
Example

/* STRTIME.C */

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

void main( void )
{
char dbuffer [9];
char tbuffer [9];
_strdate( dbuffer );
printf( "The current date is %s \n", dbuffer );
_strtime( tbuffer );
printf( "The current time is %s \n", tbuffer );
}


Output

The current date is 03/23/93
The current time is 13:40:40






Regards,

Paul Belikian