_strtime, _wstrtime
time.h:インデックス への移動
ヘッダーファイル
time.h
カテゴリ
日付/時刻ルーチン
プロトタイプ
char *_strtime(char *buf);
wchar_t *_wstrtime(wchar_t *buf);
説明
現在の時刻を文字列に変換します。
_strtime は,現在の時刻を文字列に変換し,それをバッファ buf に格納します。バッファは 9 文字以上である必要があります。
この文字列の構文は次のとおりです。
HH:MM:SS
HH,MM,SS は,それぞれ時,分,秒を 2 桁の数字で表します。文字列はヌル文字で終了します。
戻り値
_strtime は,buf(時刻文字列のアドレス)を返します。
例
#include <time.h>
#include <stdio.h>
void main(void)
{
char datebuf[9];
char timebuf[9];
_strdate(datebuf);
_strtime(timebuf);
printf("Date: %s Time: %s\n",datebuf,timebuf);
}
移植性
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
_strtime |
+ |
|||
_wstrtime |
+ |