RTC DS1307 issue

joyce973:
Now, the problem is when I compile the code and transfer it to the arduino, the serial monitor does not print the right values, but just a series of 255 values.

Have you got an example of the output? As far as I can see, the output should at least be formatted as a date/time value, even if the numbers are wrong.

I don't know what the Wire interface does, but Serial returns -1 (0xFF or 255) when there is no byte available. Do you need to wait until there is a byte available on the Wire interface before reading it?