Correct year display RTC

Hello, i have a little problem with displaying correct year with RTC I2C connection.

My code is:

   sprintf(buffer, "%02d/%02d/%02d",, now.month(), now.year());
   lcd.print( buffer );

my display start blinking and year is 2013. It is 4 digits but by code should be 2. I tryed "%02d/%02d/%04d" same problem, "%02d/%02d/%d" same problem. I like ofcourse visible full year, but i want correct code. Thanks a lot.

If I recall my printf() from years ago, the 2 in "%02d" sets the MINIMUM length of the field. If your number has more than 2 digits it prints them all. Try:

   sprintf(buffer, "%02d/%02d/%02d",, now.month(), now.year()%100);

That will strip off those nasty century digits.