'class HardwareSerial' has no member named 'sprintf'

I HAVE THIS ISSUE AND I TRIED EVERYTHING PLEASE HELP

//7 RTC Tutorial

#include <U8glib.h> // OLED
#include <Wire.h> // I2C
#include <Time.h> // Time Manipulation
#include <DS1307RTC.h> // DS1307 RTC

char timebuf[10]; // Time
char datebuf[10]; // Date
int year2digit; // 2 digit year
int year4digit; // 4 digit year

void setup(void) {
}

void loop(void) {

tmElements_t tm;
if (RTC.read(tm)) {
year2digit = tm.Year - 30; // 2 digit year variable
// year4digit = tm.Year + 1970; // 4 digit year variable
Print;

}

delay(1000); // Delay of 1sec

}
void Print(){

Serial.sprintf(timebuf, "%02d:%02d:%02d",tm.Hour, tm.Minute, tm.Second ); // format time
Serial.sprintf(datebuf, "%02d/%02d/%02d",tm.Day, tm.Month, year2digit ); // format date

}
}

sprintf prints to a string buffer, so it isn't surprising that Serial doesn't implement it.
Serial does, however, implement a method to print the contents of a string buffer, called "print".
Please get into the habit of using code tags when posting code.

houssienmortada:
I HAVE THIS ISSUE AND I TRIED EVERYTHING PLEASE HELP

Try as hard as you may, sprintf will never work with HardwareSerial because H.S. has no function (member) with that name.

I think what you want to do is THIS:

int hours = 4;
int mins = 34;
char buffer [64]; // must be large enough for your whole string!
sprintf (buffer, "The time is HOURS: %02d, MINUTES: %02d", hours, mins).
Serial.print (buffer);

Will result in:

[b]The time is HOURS: 04, MINUTES: 34

[/b]

Hope this helps.

You seem to be missing the command

Serial.begin(9600);

which goes in the setup section, which is currently empty.

Whatever other problems you have, if any, Serial won't do anything until it is initialised.