LoginSignup
2
1

More than 5 years have passed since last update.

今日の日付を表示するプログラム C言語

Posted at

はじめに

今日の日付を表示するプログラムを書いてみました

ソースコード

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

int main (void) {
    time_t t = time(NULL);
    struct tm tm;
    char str[81];

    localtime_s(&tm,&t);

    strftime(str,sizeof(str),"%Y-%m-%d %H:%I:%S",&tm);

    printf("%s",str);

    return 0;
}

実行結果!

hizuke.png

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1