にちにちメモ

天文系大学院生のブログ。日々の生活の中で忘れがちなこと/忘れたくないことをメモ。

C言語で現在時刻(年月日含む)の取得

C言語で年月日含んだ現在時刻を取得する関数。

#include<stdio.h>
#include<time.h>

int main(void)
{
  time_t nowTime;
  time(&nowTime);

  printf("%s \n", ctime(&tnowTime));

  return 0;
}

 

以下のページを参考にしました。

time