Found this on MSDN:

Code:
 // crt_asctime.c
#include <time.h>
#include <stdio.h>

struct tm *newtime;
time_t aclock;

int main( void )
{
   time( &aclock );   // Get time in seconds
   newtime = localtime( &aclock );   // Convert time to struct tm form 

   /* Print local time as a string */
   printf( "Current date and time: %s", asctime( newtime ) );
}