トップページ > キーワード検索 > asctime()
C言語規格
C言語(その他)
プログラム
その他
asctime()
機能 詳細時刻を文字列に変換する。
定義 #include <time.h>

char * asctime ( const struct tm * timeptr );
引数
timeptr詳細時刻が格納されたtm構造体へのポインタ
戻り値 変換した文字列へのポインタを返す。
実装例
#include <time.h>
#include <stdio.h>

int main(void)
{
    struct tm t = {0};
    char *s;
    
    t.tm_year  = 2014 - 1900;  /* 2014年 */
    t.tm_mon   = 1 - 1;        /* 1月    */
    t.tm_mday  = 1;            /* 1日    */
    t.tm_hour  = 0;            /* 0時    */
    t.tm_min   = 0;            /* 0分    */
    t.tm_sec   = 0;            /* 0秒    */
    t.tm_isdst = -1;           /* 夏時間不明 */
    
    s = asctime(&t);
    
    printf("%s\n", s);
    
    return 0;
}
実行結果
Sun Jan 01 00:00:00 2014






inserted by FC2 system