boost date_time使用
来源:互联网 发布:淘宝美工设计技巧 编辑:程序博客网 时间:2024/05/21 12:45
1 posix_time 使用的时候
boost::posix_time::ptime ptime1 = boost::posix_time::time_from_string(std::string(str1)));
boost::posix_time::ptime ptime2 = boost::posix_time::time_from_string(std::string(str2)));
判断 equal函数
(ptime1 == ptime2)?true:false
greaterthan函数
(ptime1 > ptime2)?true:false
lessthan 函数
(ptime1 < ptime2)?true:false
当time1=2011-01-11 00:00:00
time2 = 2011-01-11
测试结果:
time1跟time2是不相等
time1 也不大于 time2
time1 小于time2
2 计算时间相差的天数
date day1 = from_simple_string("2001-10-9");
date today = day_clock::local_day();
days days_limint = today-day1;
struct stat stInfo;
time_t tt;
stat("F:\\yuj\\test_env\\11.txt",&stInfo);
tt = stInfo.st_ctime;
ptime pt = boost::posix_time::from_time_t(tt);
date fileDate = pt.date();
days days_limint2 = fileDate-today;
printf("相差%d天 \n",days_limint.days());
printf("相差%d天 \n",days_limint2.days());
- boost date_time使用
- Boost库使用----date_time类库
- boost.date_time
- date_time boost
- 编译boost date_time
- 《Boost程序完全开发》跟踪学习训练一:Boost::date_time库的使用
- boost::date_time之时间处理
- 修改Boost.date_time代码兼容VC6
- Boost库中date_time库介绍
- 服务端统一时间戳 boost::date_time UTC
- boost库学习之 date_time库
- Boost之日期时间处理(date_time库)
- 深入浅出学习boost的date_time库(一 )
- 被boost的date_time库郁闷了一把
- cannot find the flags to link with Boost date_time 错误修复
- boost完全开发指南第2章-处理时间5 (date_time库简单运用)
- Boost库学习随记二 date_time、time_duration、date_facet、time_facet、timer库示例等:
- Date_Time(继承)
- 了解.net MVC的实现原理Controller/Action
- C语言左值和右值
- UNIX时间戳的应用-JAVA
- mainCRTStartup
- spi的platform_device
- boost date_time使用
- spring mvc 注解验证springmodules common validator (注解验证)
- C# WinForm开发系列 - Socket/WCF/Rometing/Web Services
- repalce
- poj2381
- Android Thread interrupt 中断JAVA线程
- 回调函数
- 麻辣烫的项目管理随笔
- window下 android adb常用命令