牵着老婆满街逛

严以律己,宽以待人. 三思而后行.
GMail/GTalk: yanglinbo#google.com;
MSN/Email: tx7do#yahoo.com.cn;
QQ: 3 0 3 3 9 6 9 2 0 .

导航

<2025年4月>
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

统计

公告

言论:
1.每日自省;
2.享受人生;
3.尽力而为;
4.坚持不懈;
5.切莫急躁;
6.慎言敏行;
7.动心忍性;
8.上善若水。

常用链接

留言簿(11)

随笔分类(466)

随笔档案(1513)

文章分类(46)

文章档案(45)

相册

收藏夹(39)

工具官网

技术网站

开源网站

其他窝点

收藏网站

银行官网

友情链接

资源共享

搜索

积分与排名

最新评论

阅读排行榜

获取 struct tm中的正确时间

年份需要加上1900,貌似得到的值只是求得了从 1900经历了多少年....
然后月份需要加上1,这个是为什么,我忘记了=.=

#include <time.h>
time_t tval;
struct tm *now;        
time(
&tval);
now 
= localtime(&tval);
const int& day = now->tm_mday; //获得几号
const int year = now->tm_year + 1900//获取年份 
const int month = now->tm_mon + 1//获取当前月份
const int& hour = now->tm_hour; //获取当前为几时
const int& minu = now->tm_min; //获取分钟
const int& sec = now->tm_sec;//

posted on 2007-07-22 21:07 杨粼波 阅读(1554) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理