problem with fill a String

I have the function “getTimeS()” in it I get the actual time (hour, minute, second).
The values are added to the String.

If I print the String, I get no chars.
And if I print the String.length(), I get a 0.

I don’t know where the mistake is.

String getTimeS(){
  int hour = rtc_clock.get_hours();
  int minute = rtc_clock.get_minutes();
  int second = rtc_clock.get_seconds();

  String s = "";

  if (hour < 10)
    s = "0";
  s += (String)hour;
  s += ":";
  if (minute < 10)
    s += "0";
  s += (String)minute;
  s += ":";
  if (second < 10)
    s += "0";
  s += (String)second;

  Serial.print("String length:     ");
  Serial.println((s.length()), DEC);

  return s;

I get this in the Serial Monitor

Stering length: 0

Not a real help to your problem but i use this:

void digitalClockDisplay()
  sprintf(_timeBuffer, "%02d:%02d:%02d %02d-%02d-%4d", hour(), minute(), second(), day(), month(), year());

If you have a lot of String usage in your sketch, the memory allocation that occurs behind the scenes may exhaust or fragment your available RAM. When that happens, unpredictable behaviour results. It's hard to tell from just that fragment, but you're doing a lot of what appear to be unnecessary casts to String, which will be contributing to the problem. Better to use plain old C arrays of char when you have so little RAM available.

The RAM is not the problem I use the Arduino Due :) But thx