获取当前系统时间
来源:互联网 发布:java计算圆的面积 编辑:程序博客网 时间:2024/05/01 22:17
获取当前系统时间的方法一:
CTime time = CTime::GetCurrentTime();
//构造CTime对象
int m_nYear = time.GetYear();
//年
int m_nMonth = time.GetMonth();
//月
int m_nDay = time.GetDay();
//日
int m_nHour = time.GetHour();
//小时
int m_nMinute = time.GetMinute();
//分钟
int m_nSecond = time.GetSecond();
//秒
还可以用CTime::Format函数将CTime对象转换为字符串对象
CTime t = CTime::GetCurrentTime();
Cstring date =t.Format("%Y年%m月%d日");
Cstring week =t.Format("%a");
Cstring time =t.Format("%H:%M");
方法二:
CStringstr;
time_t t;
struct tmtmtime;
time(&t);
localtime_s(&tmtime,&t);
str1.Format("%02u:%02u:%02u",tmtime.tm_hour, tmtime.tm_min, tmtime.tm_sec);
0 0
- 获取系统当前时间
- 获取当前系统时间
- 获取当前系统时间
- 获取系统当前时间
- 获取系统当前时间
- 获取当前系统时间
- 获取系统当前时间
- 获取系统当前时间
- 获取系统当前时间
- 获取当前系统时间
- 获取系统当前时间
- 获取系统当前时间
- 获取当前系统时间
- 获取系统当前时间
- 获取系统当前时间:
- 获取当前系统时间
- 获取当前系统时间
- 获取系统当前时间
- 基于 OGRE 粒子系统的喷泉模拟
- Android简单封装类似JQuery异步请求
- git-安装、配置与使用
- opencv的牛人博客
- Python实现快捷得到亚太区任意国家的IP段
- 获取当前系统时间
- 安卓实现在百度地图上播放历史轨迹
- CSS实现兼容性的渐变背景(gradient)效果
- 【CF】 159 D Palindrome pairs
- GCC 编译详解
- Little study of Setting Windows Schedule job
- System.getProperty()常用值
- hadoop 2.6 编译
- Oracle 权限相关