问题描述
用c ++获取系统日期是否容易?
像SQL或VB这样的东西?
-
问候,
温
Is it easy to get the system date in c++?
Somethings like in SQL or VB?
--
Regards,
Wen
推荐答案
//获取系统日历时间
std :: time_t tt = std :: time(0);
//将其转换为tm struct
std :: tm ttm = * std :: localtime(& tt);
//提取日,月,年的值
int mday = ttm .tm_mday;
...
Victor
// get the system calendar time
std::time_t tt = std::time(0);
// convert it into tm struct
std::tm ttm = *std::localtime(&tt);
// extract the values for day, month, year
int mday = ttm.tm_mday;
...
Victor
//得到系统日历时间
std :: time_t tt = std :: time(0);
//将其转换为tm struct
std :: tm ttm = * std :: localtime(& tt);
//提取日,月,年的值
int mday = ttm.tm_mday;
...
Victor
// get the system calendar time
std::time_t tt = std::time(0);
// convert it into tm struct
std::tm ttm = *std::localtime(&tt);
// extract the values for day, month, year
int mday = ttm.tm_mday;
...
Victor
这篇关于系统日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!