C/C++/MFC时间用法
来源:互联网 发布:手机淘宝触屏版官网 编辑:程序博客网 时间:2024/04/29 07:05
1. C\C++中用法
/* strftime example */#include <stdio.h> /* puts */#include <time.h> /* time_t, struct tm, time, localtime, strftime */int main (){time_t rawtime;struct tm * timeinfo;char buffer [80];time (&rawtime);timeinfo = localtime (&rawtime);strftime (buffer,80,"Now it's %m/%d/%y, %H:%M:%S.",timeinfo);puts (buffer);return 0;}
2.MFC用法
CString str; //获取系统时间 CTime tm; tm=CTime::GetCurrentTime(); str=tm.Format("现在时间是%Y年%m月%d日 %X");MessageBox(str,NULL,MB_OK);
CString sDateTime1,sDateTime2;sDateTime1 = s1.c_str();sDateTime2 = s2.c_str();int nYear, nMonth, nDate, nHour, nMin, nSec;sscanf(sDateTime1, "%d/%d/%d-%d:%d:%d", &nMonth, &nDate, &nYear, &nHour, &nMin, &nSec);nYear +=2000;CTime sTime1(nYear, nMonth, nDate, nHour, nMin, nSec); sscanf(sDateTime2, "%d/%d/%d-%d:%d:%d", &nMonth, &nDate, &nYear, &nHour, &nMin, &nSec);nYear +=2000;CTime sTime2(nYear, nMonth, nDate, nHour, nMin, nSec); CTimeSpan span = sTime2 - sTime1;span.GetTotalSeconds();
0 0
- C/C++/MFC时间用法
- C++/MFC-时间与日期
- MFC&C读取,保存时间
- C/C++ 时间相关用法
- c++\MFC测试代码的运行时间
- 标准C语言各种时间函数用法
- C/C++ 时间、日期函数 用法总结
- 标准C语言各种时间函数用法
- c++mfc
- C++-->MFC
- C/C++/MFC
- C#.net时间函数的用法 时间格式输出
- C语言 获得系统时间以及时间函数的用法。
- 【C++】Visual Studio 2012 MFC中添加OnTimer时间函数
- 使用CTime类,获取系统时间C/MFC
- 文件处理函数如何使用?用法举例,C与MFC
- 文件处理函数如何使用?用法举例,C与MFC
- MFC,win32,linux C中SetTimer定时器用法
- Log4cpp 写本地日志 简单的配置文件 自定义文件名
- 深入理解NFC
- 5、JS中输出九九乘法表
- poj2531--Network Saboteur(搜索练习7-dfs或随机算法)
- 开餐饮店之前如何进行市场考察UL精品游戏
- C/C++/MFC时间用法
- 。。。
- OpenGL学习日记-2014.12.21--光照
- 为什么要用回调函数?
- liferay6.2开发之索引查询
- 四、Mysql数据类型图
- jquery 的onload、ready、js对象成转换jquery节点
- javascript笔记:函数
- Linux IIC驱动实例