获取时间 & 格式化输出到字符串
#include "stdafx.h"
#include <time.h>
#include <stdio.h>
int main()
{
struct tm *p;
char filename[16];
time_t timeData;
timeData = time(NULL);
p = localtime(&timeData);
sprintf_s(filename, "%02d-%02d-%02d-%02d.ubh", p->tm_mon + 1, p->tm_mday, p->tm_hour, p->tm_min,16);
//printf("%02d-%02d-%02d-%02d", p->tm_mon + 1,p->tm_mday,p->tm_hour,p->tm_min);
printf("%s", filename);
getchar();
return 0;
}```