itoa issue with long number

Greetings,
Could someone please help me out of this problem?
Many thanks!

void setup() {
  Serial.begin(38400);
  Serial.println("starting");
  unsigned long epoch=1562230571;
  char epochStr[]="1562230571";
  Serial.println(epoch);
  itoa(epoch, epochStr, 10);
  Serial.println(epochStr);
}

void loop(void) {
;
}

monitor output:
starting
1562230571
-16597

An unsigned long != int.

Thank you!

was wandering if there was a compiler switch to complain of such type mismatch? I have compiling warnings all

Such "type mismatches" happen all the time, and are sometimes desired.

In your case, use ltoa() instead, and be aware of the difference.