如何得到已经格式化好的时间字符串? 要包括年月日的,谢谢了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 方法很多: SYSTEMTIME GetLocalTime, 或者time, 得到年月日,再sprintf即可还可以使用日期控件,再用Format方法. 函数名称: asctime函数原型: char* asctime(struct tm * ptr)函数功能: 得到机器时间(日期时间转换为ASCII码)函数返回: 返回的时间字符串格式为:星期,月,日,小时:分:秒,年参数说明: 结构指针ptr应通过函数localtime()和gmtime()得到所属文件: <time.h>#include <stdio.h>#include <string.h>#include <time.h>int main(){ struct tm t; char str[80]; t.tm_sec=1; t.tm_min=3; t.tm_hour=7; t.tm_mday=22; t.tm_mon=11; t.tm_year=56; t.tm_wday=4; t.tm_yday=0; t.tm_isdst=0; strcpy(str,asctime(&t)); printf("%s",str); return 0;} SYSTEMTIME, GetLocalTime()年月日,小时,分,秒,星期几都有 求教一个系统开发的问题 如何实现异地协同办公 WaitForMultipleObjects中参数的问题 CScrollView怎么刷新背景图象? 用fstream打开文件后,如何转到文件尾部? 请问一下高手,有没有做过通过虚拟网卡驱动来抓所有网络数据报的。 to:LiRen(利刃) http://win32assembly.online.fr/ 高人给看一下:在MFC中使用itk总是内存泄漏? MFC运用设计模式 各位老板,我想把一个窗体贴到SDI客户区怎么做,另外还有两个问题。。。。先谢谢。 关于dll中的对话框播放flash的问题 VC全局HOOK给主窗口发送鼠标消息
SYSTEMTIME GetLocalTime, 或者time, 得到年月日,再sprintf即可
还可以使用日期控件,再用Format方法.
函数原型: char* asctime(struct tm * ptr)
函数功能: 得到机器时间(日期时间转换为ASCII码)
函数返回: 返回的时间字符串格式为:星期,月,日,小时:分:秒,年
参数说明: 结构指针ptr应通过函数localtime()和gmtime()得到
所属文件: <time.h>#include <stdio.h>
#include <string.h>
#include <time.h>
int main()
{
struct tm t;
char str[80];
t.tm_sec=1;
t.tm_min=3;
t.tm_hour=7;
t.tm_mday=22;
t.tm_mon=11;
t.tm_year=56;
t.tm_wday=4;
t.tm_yday=0;
t.tm_isdst=0;
strcpy(str,asctime(&t));
printf("%s",str);
return 0;
}
年月日,小时,分,秒,星期几都有