📜  在 C++ 代码示例中获取当前日期

📅  最后修改于: 2022-03-11 14:44:58.028000             🧑  作者: Mango

代码示例1
#include 
#include 

int main() {
    std::time_t t = std::time(0);   // get time now
    std::tm* now = std::localtime(&t);
    std::cout << (now->tm_year + 1900) << '-' 
         << (now->tm_mon + 1) << '-'
         <<  now->tm_mday
         << "\n";
}