#include <iostream>
#include <time.h>
struct StDate
{
long year;
long month;
long day;
};
int main()
{
const time_t now = time(NULL);
const tm* ts = localtime(&now);
const StDate date = { ts->tm_year+1900, ts->tm_mon+1, ts->tm_mday };
std::cout << date.year << "-" << date.month << "-" << date.day << std::endl;
return 0;
}
ただ、なんだかよくわからないけど気に入らないので、他のやり方を知ってるかたがいれば、
ぜひ教えていただきたいです。
よろしくお願いします。
ちなみに言語はC++オンリーでお願いします。