機能 |
歴時刻の要素(詳細時刻)を保持する型。 |
|||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
定義 |
#include <time.h> struct tm tm構造体は以下のメンバを含む。
|
|||||||||||||||||||||||||||||||
実装例 |
#include <time.h> #include <stdio.h> int main(void) { struct tm *tp; time_t t; time(&t); tp = localtime(&t); printf("%d/%d/%d %02d:%02d:%02d\n", (tp->tm_year + 1900), (tp->tm_mon + 1), tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec); return 0; } |
|||||||||||||||||||||||||||||||
実行結果 |
2014/5/3 12:00:15 |
tm