`
shaojiashuai123456
  • 浏览: 256820 次
  • 性别: Icon_minigender_1
  • 来自: 吉林
社区版块
存档分类
最新评论

c 获取系统时间

阅读更多
#include<time.h>
#include<stdio.h>
int main()
{
	time_t now;
	time(&now);
	//ctime 转换为字符串
	printf("ctime:%s",ctime(&now));


	struct tm *t;
	t=localtime(&now);
	char n[100];
                //格式化输出字符串
	strftime(n,100,"%F %T",t);
	printf("strftime:%s\n",n);
	return 0;
}

  

 

  • 大小: 1.2 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics