C语言下获取当前时间并格式化成字符串的方法-可用作截图或者录像的文件名

来源:互联网 发布:免费相册制作软件下载 编辑:程序博客网 时间:2024/05/16 08:11

#include <time.h>

#include <stdlib.h>

#include <stdio.h>

 

void FormatCurrentTimeString(char* pszCurrTime, int nCurrTimeSize)

{

time_t now;

time(&now);

 

strftime(pszCurrTime, nCurrTimeSize, "%Y%m%d%H%M%S", localtime(&now));

}

原创粉丝点击