VC 时间相关函数
时间函数
#include <time.h>
#include <stdio.h>
int main( void )
{
    time_t t = time( 0 );
    char tmp[64];
    strftime( tmp, sizeof(tmp), "%Y/%m/%d %X %A 本年第%j天 %z", 
    localtime(&t) );
    puts( tmp );
    return 0;
} 能取年月日,分秒,不能取到毫秒
能取到毫秒
#include <windows.h>
#include <stdio.h>
int main( void )
{
        SYSTEMTIME sys;
        GetLocalTime( &sys );
        printf( "%4d/%02d/%02d %02d:%02d:%02d.%03d 星期%1d\n"
                ,sys.wYear,sys.wMonth,sys.wDay
                ,sys.wHour,sys.wMinute,sys.wSecond,sys.wMilliseconds
                ,sys.wDayOfWeek);
        return 0;
} 
                    
                
 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号