如何取得標準時間字串

有關於C/C++的語法, 程式等
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

如何取得標準時間字串

文章 tim »

請參考,
http://msdn.microsoft.com/library/defau ... gmtime.asp

代碼: 選擇全部

     
    /* GMTIME.C: This program uses gmtime to convert a long- 
     * integer representation of coordinated universal time 
     * to a structure named newtime, then uses asctime to 
     * convert this structure to an output string. 
     */ 
     
    #include <time.h> 
    #include <stdio.h> 
     
    void main( void ) 
    { 
       struct tm *newtime; 
       long ltime; 
     
       time( &ltime ); 
     
       /* Obtain coordinated universal time: */ 
       newtime = gmtime( &ltime ); 
       printf( "Coordinated universal time is %sn",  
                                   asctime( newtime ) ); 
    } 
多多留言, 整理文章, 把經驗累積下來.....
回覆文章