您的位置:首页 > 编程语言 > C语言/C++

uct时间格式如何转换成北京时间

2013-08-06 10:21 501 查看
uct时间格式如何转换成北京时间

得到一个UCT时间格式 如:1346030160

如何才能转换成:2012/08/27,09:16:00

void CEeDlg::OnButton18() 

{

 // TODO: Add your control notification handler code here

 time_t ltime = time(NULL);//1346030160;

    char buf[30] = {0};

 struct tm *timeptr = localtime(<ime);

 strftime(buf,30,"%Y/%m/%d %H:%M:%S \n" , timeptr);

 long nlocaltime2 = time(NULL);

    struct tm *timeptr2 = localtime(&nlocaltime2);

 

    strftime(buf,30,"%Y/%m/%d %H:%M:%S \n" , timeptr2);

 CString csT = buf;

    printf(buf);

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  vc++