Byte to Char

does

byte minute =12;
byte hour=14;
byte dayOfMonth=28;
byte month=10;
char TimeDate[9];
sprintf (TimeDate, "%02u%02u%02u%02u",month,dayOfMonth,hour,minute);

work ?

"%02u" means unsigned 2digits with leading zero.

  • You need space for a trailing 0 as end of string indicator, so TimeDate has to be at least 9 chars wide .
  • You don't need string.h
  • If it's just to create a file name, you can do that in one shot:
      sprintf (TimeDate, "%02u%02u%02u%02u.log",month,dayOfMonth,hour,minute); should produce "10281412.log"