Once you have your time in a struct tm
you can use strftime
#include <stdio.h>
#include <string.h>
#include <time.h>
int main()
{
struct tm *tp;
time_t t;
char s[80];
t = time(NULL);
tp = localtime(&t);
strftime(s, 80, "%b %d %H:%M %Y", tp);
strcat(s, " 2-s.txt");
printf("%s\n", s);
return 0;
}
output:
Jul 19 07:57 2013 2-s.txt